linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: smfrench@gmail.com
Subject: [PATCH 4/4] [SMB3] Fix coverity warning
Date: Fri, 27 Mar 2015 00:28:02 -0500	[thread overview]
Message-ID: <1427434082-4299-5-git-send-email-smfrench@gmail.com> (raw)
In-Reply-To: <1427434082-4299-1-git-send-email-smfrench@gmail.com>

Coverity reports a warning for referencing the beginning of the
SMB2/SMB3 frame using the ProtocolId field as an array. Although
it works the same either way, this patch should quiet the warning
and might be a little clearer.

Reported by Coverity (CID 741269)

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/smb2misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 689f035..22dfdf1 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -322,7 +322,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
 
 	/* return pointer to beginning of data area, ie offset from SMB start */
 	if ((*off != 0) && (*len != 0))
-		return hdr->ProtocolId + *off;
+		return (char *)(&hdr->ProtocolId[0]) + *off;
 	else
 		return NULL;
 }
-- 
1.9.1


  parent reply	other threads:[~2015-03-27  5:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  5:27 [PATCH 0/4] Fix various coverity warnings in fs/cifs Steve French
2015-03-27  5:27 ` [PATCH 1/4] [SMB3] Fix warning on uninitialized buftype Steve French
2015-03-28 14:19   ` Shirish Pargaonkar
2015-03-30  9:36   ` Sachin Prabhu
2015-04-01  0:35   ` Jeff Layton
2015-03-27  5:28 ` [PATCH 2/4] [CIFS] Don't ignore errors on encrypting password in SMBTcon Steve French
2015-03-28 14:26   ` Shirish Pargaonkar
2015-03-30  9:44   ` Sachin Prabhu
2015-04-01  0:37   ` Jeff Layton
2015-03-27  5:28 ` [PATCH 3/4] [SMB3] Fix dereference before null check warning Steve French
2015-03-28 14:27   ` Shirish Pargaonkar
2015-03-30  9:50   ` Sachin Prabhu
2015-04-01  0:46   ` Jeff Layton
2015-04-01  5:00     ` Steve French
2015-04-01 11:07       ` Jeff Layton
2015-03-27  5:28 ` Steve French [this message]
2015-03-28 15:05   ` [PATCH 4/4] [SMB3] Fix coverity warning Shirish Pargaonkar
2015-03-30  9:51   ` Sachin Prabhu
2015-04-01  0:38   ` Jeff Layton

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=1427434082-4299-5-git-send-email-smfrench@gmail.com \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@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).