aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2024-02-05 14:43:17 -0600
committerSteve French <stfrench@microsoft.com>2024-02-08 10:50:40 -0600
commit45be0882c5f91e1b92e645001dd1a53b3bd58c97 (patch)
tree033a9272806d208479c9f55ace4c173da7fcfe60
parent54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478 (diff)
downloadlinux-sparc-45be0882c5f91e1b92e645001dd1a53b3bd58c97.tar.gz
smb3: add missing null server pointer check
Address static checker warning in cifs_ses_get_chan_index(): warn: variable dereferenced before check 'server' To be consistent, and reduce risk, we should add another check for null server pointer. Fixes: 88675b22d34e ("cifs: do not search for channel if server is terminating") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/sess.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index ed4bd88dd528a..476d54fceb50f 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -76,7 +76,7 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
unsigned int i;
/* if the channel is waiting for termination */
- if (server->terminate)
+ if (server && server->terminate)
return CIFS_INVAL_CHAN_INDEX;
for (i = 0; i < ses->chan_count; i++) {