summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.org>2025-07-26 13:38:52 -0300
committerSteve French <stfrench@microsoft.com>2025-07-28 09:40:36 -0500
commit524fa5bcc384491140323f12bf12b6e3e0f5b84d (patch)
treea4a016641d35fd82c97528996899d0954ef6a78b
parente5acab35feffb6f1b7f4ee0d146666a241024804 (diff)
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) <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/fs_context.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index 18b55f243b4cb..c332d110704a2 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1482,12 +1482,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
ctx->password = NULL;
if (strlen(param->string) == 0)
break;
-
- ctx->password = kstrdup(param->string, GFP_KERNEL);
- if (ctx->password == NULL) {
- cifs_errorf(fc, "OOM when copying password string\n");
- goto cifs_parse_mount_err;
- }
+ ctx->password = no_free_ptr(param->string);
break;
case Opt_pass2:
kfree_sensitive(ctx->password2);