From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: re: [CIFS] fix static checker warning
Date: Mon, 18 May 2015 15:33:44 +0300 [thread overview]
Message-ID: <20150518123344.GE32633@mwanda> (raw)
[ I recently changed the checker so now it gives a new warning about
this old code. ]
Hello Steve French,
The patch 84ceeb962665: "[CIFS] fix static checker warning" from Jun
26, 2013, leads to the following static checker warning:
fs/cifs/smb2pdu.c:136 smb2_hdr_assemble()
warn: variable dereferenced before check 'tcon->ses->server' (see line 120)
fs/cifs/smb2pdu.c
111 /* GLOBAL_CAP_LARGE_MTU will only be set if dialect > SMB2.02 */
112 /* See sections 2.2.4 and 3.2.4.1.5 of MS-SMB2 */
113 if ((tcon->ses) &&
114 (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
^^^^^^^^^^^^^^^^^
Dereferenced without a check.
115 hdr->CreditCharge = cpu_to_le16(1);
116 /* else CreditCharge MBZ */
117
118 hdr->TreeId = tcon->tid;
119 /* Uid is not converted */
120 if (tcon->ses)
121 hdr->SessionId = tcon->ses->Suid;
122
123 /*
124 * If we would set SMB2_FLAGS_DFS_OPERATIONS on open we also would have
125 * to pass the path on the Open SMB prefixed by \\server\share.
126 * Not sure when we would need to do the augmented path (if ever) and
127 * setting this flag breaks the SMB2 open operation since it is
128 * illegal to send an empty path name (without \\server\share prefix)
129 * when the DFS flag is set in the SMB open header. We could
130 * consider setting the flag on all operations other than open
131 * but it is safer to net set it for now.
132 */
133 /* if (tcon->share_flags & SHI1005_FLAGS_DFS)
134 hdr->Flags |= SMB2_FLAGS_DFS_OPERATIONS; */
135
136 if (tcon->ses && tcon->ses->server && tcon->ses->server->sign)
^^^^^^^^^^^^^^^^^
Checked too late.
137 hdr->Flags |= SMB2_FLAGS_SIGNED;
138 out:
139 pdu->StructureSize2 = cpu_to_le16(parmsize);
140 return;
regards,
dan carpenter
next reply other threads:[~2015-05-18 12:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 12:33 Dan Carpenter [this message]
2015-05-20 16:21 ` [CIFS] fix static checker warning Steve French
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=20150518123344.GE32633@mwanda \
--to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.