* [PATCH] smb: client: fix sbflags initialization
@ 2026-03-06 15:07 Arnd Bergmann
2026-03-06 15:17 ` Paulo Alcantara
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2026-03-06 15:07 UTC (permalink / raw)
To: Steve French, Paulo Alcantara, David Howells
Cc: Arnd Bergmann, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Bharath SM, Henrique Carvalho, Markus Elfring, Al Viro,
linux-cifs, samba-technical, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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>
---
fs/smb/client/dir.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
index 953f1fee8cb8..55ffbdc17c8a 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;
@@ -367,7 +367,6 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
* 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,
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] smb: client: fix sbflags initialization
2026-03-06 15:07 [PATCH] smb: client: fix sbflags initialization Arnd Bergmann
@ 2026-03-06 15:17 ` Paulo Alcantara
2026-03-08 3:15 ` Steve French
0 siblings, 1 reply; 3+ messages in thread
From: Paulo Alcantara @ 2026-03-06 15:17 UTC (permalink / raw)
To: Arnd Bergmann, Steve French, David Howells
Cc: Arnd Bergmann, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Bharath SM, Henrique Carvalho, Markus Elfring, Al Viro,
linux-cifs, samba-technical, linux-kernel
Arnd Bergmann <arnd@kernel.org> writes:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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>
> ---
> fs/smb/client/dir.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] smb: client: fix sbflags initialization
2026-03-06 15:17 ` Paulo Alcantara
@ 2026-03-08 3:15 ` Steve French
0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2026-03-08 3:15 UTC (permalink / raw)
To: Paulo Alcantara
Cc: Arnd Bergmann, Steve French, David Howells, Arnd Bergmann,
Ronnie Sahlberg, Shyam Prasad N, Tom Talpey, Bharath SM,
Henrique Carvalho, Markus Elfring, Al Viro, linux-cifs,
samba-technical, linux-kernel
Good catch.
Added the Reviewed-by and merged into cifs-2.6.git for-next
On Fri, Mar 6, 2026 at 9:17 AM Paulo Alcantara <pc@manguebit.org> wrote:
>
> Arnd Bergmann <arnd@kernel.org> writes:
>
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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>
> > ---
> > fs/smb/client/dir.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
>
> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-08 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 15:07 [PATCH] smb: client: fix sbflags initialization Arnd Bergmann
2026-03-06 15:17 ` Paulo Alcantara
2026-03-08 3:15 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox