]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: get rid of kstrdup() when parsing domain mount option
authorPaulo Alcantara <pc@manguebit.org>
Sat, 26 Jul 2025 16:45:43 +0000 (13:45 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 28 Jul 2025 14:42:05 +0000 (09:42 -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 f29efc03e8050bb5e23c684e44ca207dc2c10639..8b7ad5bf3302b662686965bff1f15494986830ba 100644 (file)
@@ -1512,11 +1512,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                }
 
                kfree(ctx->domainname);
-               ctx->domainname = kstrdup(param->string, GFP_KERNEL);
-               if (ctx->domainname == NULL) {
-                       cifs_errorf(fc, "OOM when copying domainname string\n");
-                       goto cifs_parse_mount_err;
-               }
+               ctx->domainname = no_free_ptr(param->string);
                cifs_dbg(FYI, "Domain name set\n");
                break;
        case Opt_srcaddr: