Skip to content

Commit e5acab3

Browse files
pcacjrsmfrench
authored andcommitted
smb: client: get rid of kstrdup() when parsing user mount option
Steal string reference from @param->string rather than duplicating it. Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Reviewed-by: David Howells <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 309c2b7 commit e5acab3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/smb/client/fs_context.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,11 +1475,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
14751475
pr_warn("username too long\n");
14761476
goto cifs_parse_mount_err;
14771477
}
1478-
ctx->username = kstrdup(param->string, GFP_KERNEL);
1479-
if (ctx->username == NULL) {
1480-
cifs_errorf(fc, "OOM when copying username string\n");
1481-
goto cifs_parse_mount_err;
1482-
}
1478+
ctx->username = no_free_ptr(param->string);
14831479
break;
14841480
case Opt_pass:
14851481
kfree_sensitive(ctx->password);

0 commit comments

Comments
 (0)