Skip to content

Commit 28f0982

Browse files
pcacjrsmfrench
authored andcommitted
smb: client: get rid of kstrdup() when parsing iocharset 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 60c9511 commit 28f0982

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
@@ -1532,11 +1532,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
15321532

15331533
if (strncasecmp(param->string, "default", 7) != 0) {
15341534
kfree(ctx->iocharset);
1535-
ctx->iocharset = kstrdup(param->string, GFP_KERNEL);
1536-
if (ctx->iocharset == NULL) {
1537-
cifs_errorf(fc, "OOM when copying iocharset string\n");
1538-
goto cifs_parse_mount_err;
1539-
}
1535+
ctx->iocharset = no_free_ptr(param->string);
15401536
}
15411537
/* if iocharset not set then load_nls_default
15421538
* is used by caller

0 commit comments

Comments
 (0)