* [PATCH] cifs: silence compiler warnings showing up with gcc-8.0.0
@ 2018-02-02 15:48 Arnd Bergmann
2018-02-04 1:27 ` Steve French
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-02-02 15:48 UTC (permalink / raw)
To: Steve French
Cc: Martin Sebor, Arnd Bergmann, Pavel Shilovsky, Ronnie Sahlberg,
Aurelien Aptel, Long Li, Samuel Cabrero, Sachin Prabhu,
linux-cifs, samba-technical, linux-kernel
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 <arnd@arndb.de>
---
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 72d71703f1e8..78bc86c315ec 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -6343,9 +6343,7 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
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;
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cifs: silence compiler warnings showing up with gcc-8.0.0
2018-02-02 15:48 [PATCH] cifs: silence compiler warnings showing up with gcc-8.0.0 Arnd Bergmann
@ 2018-02-04 1:27 ` Steve French
0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2018-02-04 1:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Steve French, Martin Sebor, Pavel Shilovsky, Ronnie Sahlberg,
Aurelien Aptel, Long Li, Samuel Cabrero, Sachin Prabhu, CIFS,
samba-technical, LKML
merged into cifs-2.6.git for-next
On Fri, Feb 2, 2018 at 9:48 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 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 <arnd@arndb.de>
> ---
> 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 72d71703f1e8..78bc86c315ec 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -6343,9 +6343,7 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
> 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;
> --
> 2.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-04 1:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 15:48 [PATCH] cifs: silence compiler warnings showing up with gcc-8.0.0 Arnd Bergmann
2018-02-04 1:27 ` Steve French
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).