]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: get rid of kstrdup() when parsing user mount option
authorPaulo Alcantara <pc@manguebit.org>
Sat, 26 Jul 2025 16:36:51 +0000 (13:36 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 28 Jul 2025 14:40:20 +0000 (09:40 -0500)
Steal string reference from @param->string rather than duplicating it.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/fs_context.c

index 59ccc2229ab3008a0a0e580e3737f81c53b2720d..18b55f243b4cb162f2346c3ed7adfedb2829893b 100644 (file)
@@ -1475,11 +1475,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                        pr_warn("username too long\n");
                        goto cifs_parse_mount_err;
                }
-               ctx->username = kstrdup(param->string, GFP_KERNEL);
-               if (ctx->username == NULL) {
-                       cifs_errorf(fc, "OOM when copying username string\n");
-                       goto cifs_parse_mount_err;
-               }
+               ctx->username = no_free_ptr(param->string);
                break;
        case Opt_pass:
                kfree_sensitive(ctx->password);