]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
configfs: Correct error value returned by API config_item_set_name()
authorZijun Hu <quic_zijuhu@quicinc.com>
Wed, 7 May 2025 11:50:27 +0000 (19:50 +0800)
committerAndreas Hindborg <a.hindborg@kernel.org>
Fri, 9 May 2025 08:11:13 +0000 (10:11 +0200)
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>
fs/configfs/item.c

index 254170a82aa337d95cbfbdf1a2db1023db3a2907..c378b5cbf87d28387a509c3cabb93eccfb520c9c 100644 (file)
@@ -66,7 +66,7 @@ int config_item_set_name(struct config_item *item, const char *fmt, ...)
                name = kvasprintf(GFP_KERNEL, fmt, args);
                va_end(args);
                if (!name)
-                       return -EFAULT;
+                       return -ENOMEM;
        }
 
        /* Free the old name, if necessary. */