From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-cifs@vger.kernel.org
Subject: [bug report] CIFS: Move get_next_mid to ops struct
Date: Fri, 17 Sep 2021 16:19:39 +0300 [thread overview]
Message-ID: <20210917131939.GA31672@kili> (raw)
Hello Samba Devs,
This is a semi-automatic email about new static checker warnings.
The patch 88257360605f: "CIFS: Move get_next_mid to ops struct" from
May 23, 2012, leads to the following Smatch complaint:
^^^^
(nine years ago. :P)
fs/smbfs_client/misc.c:273 header_assemble()
warn: variable dereferenced before check 'treeCon->ses->server' (see line 267)
fs/smbfs_client/misc.c
251 buffer->Protocol[3] = 'B';
252 buffer->Command = smb_command;
253 buffer->Flags = 0x00; /* case sensitive */
254 buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
255 buffer->Pid = cpu_to_le16((__u16)current->tgid);
256 buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16));
257 if (treeCon) {
258 buffer->Tid = treeCon->tid;
259 if (treeCon->ses) {
260 if (treeCon->ses->capabilities & CAP_UNICODE)
261 buffer->Flags2 |= SMBFLG2_UNICODE;
262 if (treeCon->ses->capabilities & CAP_STATUS32)
263 buffer->Flags2 |= SMBFLG2_ERR_STATUS;
264
265 /* Uid is not converted */
266 buffer->Uid = treeCon->ses->Suid;
267 buffer->Mid = get_next_mid(treeCon->ses->server);
^^^^^^^^^^^^^^^^^^^^
Dereferenced
268 }
269 if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)
270 buffer->Flags2 |= SMBFLG2_DFS;
271 if (treeCon->nocase)
272 buffer->Flags |= SMBFLG_CASELESS;
273 if ((treeCon->ses) && (treeCon->ses->server))
^^^^^^^^^^^^^^^^^^^^
Checked too late.
274 if (treeCon->ses->server->sign)
275 buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
regards,
dan carpenter
reply other threads:[~2021-09-17 13:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210917131939.GA31672@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).