From 524fa5bcc384491140323f12bf12b6e3e0f5b84d Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Sat, 26 Jul 2025 13:38:52 -0300 Subject: [PATCH] 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) Reviewed-by: David Howells Signed-off-by: Steve French --- fs/smb/client/fs_context.c | 7 +------ 1 file changed, 1 insertion(+), 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); -- 2.47.2