Skip to contentSkip to conversation

ksmbd: Avoid duplicate variable assignment in ksmbd_vfs_path_lookup()

PATCH New Markus Elfring 1 participant 1 message Oct 4, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: Avoid duplicate variable assignment in ksmbd_vfs_path_lookup()

From: Markus Elfring <[email protected]>
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.

---
 fs/smb/server/vfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/vfs.c +2 -1
index 891ed2dc2b73..bef6761760a4 100644
@@ -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);
Signature · 1 line
2.51.0