From: Steve French Date: Mon, 5 Feb 2024 20:43:17 +0000 (-0600) Subject: smb3: add missing null server pointer check X-Git-Tag: nvme-6.9-2024-04-04~430^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=45be0882c5f91e1b92e645001dd1a53b3bd58c97;p=nvme.git 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 Reviewed-by: Shyam Prasad N Signed-off-by: Steve French --- diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index ed4bd88dd528..476d54fceb50 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++) {