Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

configfs: Correct error value returned by API config_item_set_name()

kvasprintf() failure is often caused by memory allocation which has error
code -ENOMEM, but config_item_set_name() returns -EFAULT for the failure.

Fix by returning -ENOMEM instead of -EFAULT for the failure.

Reviewed-by: Joel Becker <jlbec@evilplan.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250507-fix_configfs-v3-3-fe2d96de8dc4@quicinc.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

authored by

Zijun Hu and committed by
Andreas Hindborg
bbb67d4f f830edba

+1 -1
+1 -1
fs/configfs/item.c
··· 66 66 name = kvasprintf(GFP_KERNEL, fmt, args); 67 67 va_end(args); 68 68 if (!name) 69 - return -EFAULT; 69 + return -ENOMEM; 70 70 } 71 71 72 72 /* Free the old name, if necessary. */