Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] ksmbd: Avoid duplicate variable assignment in ksmbd_vfs_path_lookup()
@ 2025-10-04 17:09 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-04 17:09 UTC (permalink / raw)
  To: linux-cifs, Namjae Jeon, Sergey Senozhatsky, Steve French,
	Tom Talpey
  Cc: LKML, kernel-janitors, Neil Brown, Stefan Metzmacher

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 4 Oct 2025 18:56:18 +0200

Move a variable assignment into an else branch so that the variable
will not be reassigned in case an empty string was detected in
this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/server/vfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index 891ed2dc2b73..bef6761760a4 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -73,7 +73,7 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
 {
 	struct qstr last;
 	struct filename *filename __free(putname) = NULL;
-	const struct path *root_share_path = &share_conf->vfs_path;
+	const struct path *root_share_path;
 	int err, type;
 	struct dentry *d;
 
@@ -82,6 +82,7 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
 		root_share_path = NULL;
 	} else {
 		flags |= LOOKUP_BENEATH;
+		root_share_path = &share_conf->vfs_path;
 	}
 
 	filename = getname_kernel(pathname);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-04 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04 17:09 [PATCH] ksmbd: Avoid duplicate variable assignment in ksmbd_vfs_path_lookup() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox