summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2026-03-06 18:07:13 +0300
committerSteve French <stfrench@microsoft.com>2026-03-11 01:22:03 +0300
commitfae11330dc0642065568d6c0045322293fe59bc6 (patch)
treec9d14021b1a5d6bbe07b252b3a0ce06b08b93f23
parent4a7d2729dc99437dbb880a64c47828c0d191b308 (diff)
downloadlinux-fae11330dc0642065568d6c0045322293fe59bc6.tar.xz
smb: client: fix sbflags initialization
The newly introduced variable is initialized in an #ifdef block but used outside of it, leading to undefined behavior when CONFIG_CIFS_ALLOW_INSECURE_LEGACY is disabled: fs/smb/client/dir.c:417:9: error: variable 'sbflags' is uninitialized when used here [-Werror,-Wuninitialized] 417 | if (sbflags & CIFS_MOUNT_DYNPERM) | ^~~~~~~ Move the initialization into the declaration, the same way as the other similar function do it. Fixes: 4fc3a433c139 ("smb: client: use atomic_t for mnt_cifs_flags") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/dir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
index 4bc217e9a727..6d2378eeb7f6 100644
--- a/fs/smb/client/dir.c
+++ b/fs/smb/client/dir.c
@@ -187,7 +187,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
const char *full_path;
void *page = alloc_dentry_path();
struct inode *newinode = NULL;
- unsigned int sbflags;
+ unsigned int sbflags = cifs_sb_flags(cifs_sb);
int disposition;
struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_open_parms oparms;
@@ -368,7 +368,6 @@ retry_open:
* If Open reported that we actually created a file then we now have to
* set the mode if possible.
*/
- sbflags = cifs_sb_flags(cifs_sb);
if ((tcon->unix_ext) && (*oplock & CIFS_CREATE_ACTION)) {
struct cifs_unix_set_info_args args = {
.mode = mode,