cifs: silence compiler warnings showing up with gcc-8.0.0

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/ade7db991b47ab3016a414468164f4966bd08202
Commit:     ade7db991b47ab3016a414468164f4966bd08202
Parent:     ede2e520a1484924a55c8fc77a8256f5d33d2ab2
Refname:    refs/heads/master
Author:     Arnd Bergmann <[email protected]>
AuthorDate: Fri Feb 2 16:48:47 2018 +0100
Committer:  Steve French <[email protected]>
CommitDate: Wed Feb 7 09:36:41 2018 -0600

    cifs: silence compiler warnings showing up with gcc-8.0.0
    
    This bug was fixed before, but came up again with the latest
    compiler in another function:
    
    fs/cifs/cifssmb.c: In function 'CIFSSMBSetEA':
    fs/cifs/cifssmb.c:6362:3: error: 'strncpy' offset 8 is out of the bounds [0, 4] [-Werror=array-bounds]
       strncpy(parm_data->list[0].name, ea_name, name_len);
    
    Let's apply the same fix that was used for the other instances.
    
    Fixes: b2a3ad9ca502 ("cifs: silence compiler warnings showing up with gcc-4.7.0")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Steve French <[email protected]>
---
 fs/cifs/cifssmb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4e0922d24eb2..9ceebf30eb22 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -6343,9 +6343,7 @@ SetEARetry:
 	pSMB->InformationLevel =
 		cpu_to_le16(SMB_SET_FILE_EA);
 
-	parm_data =
-		(struct fealist *) (((char *) &pSMB->hdr.Protocol) +
-				       offset);
+	parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset;
 	pSMB->ParameterOffset = cpu_to_le16(param_offset);
 	pSMB->DataOffset = cpu_to_le16(offset);
 	pSMB->SetupCount = 1;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.