Skip to content

Commit 524fa5b

Browse files
pcacjrsmfrench
authored andcommitted
smb: client: get rid of kstrdup() when parsing pass 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 e5acab3 commit 524fa5b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

fs/smb/client/fs_context.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,12 +1482,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
14821482
ctx->password = NULL;
14831483
if (strlen(param->string) == 0)
14841484
break;
1485-
1486-
ctx->password = kstrdup(param->string, GFP_KERNEL);
1487-
if (ctx->password == NULL) {
1488-
cifs_errorf(fc, "OOM when copying password string\n");
1489-
goto cifs_parse_mount_err;
1490-
}
1485+
ctx->password = no_free_ptr(param->string);
14911486
break;
14921487
case Opt_pass2:
14931488
kfree_sensitive(ctx->password2);

0 commit comments

Comments
 (0)