From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-co1nam03on0104.outbound.protection.outlook.com ([104.47.40.104]:37663 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932263AbeDIAjW (ORCPT ); Sun, 8 Apr 2018 20:39:22 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnd Bergmann , Steve French , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 154/162] cifs: silence compiler warnings showing up with gcc-8.0.0 Date: Mon, 9 Apr 2018 00:29:50 +0000 Message-ID: <20180409002738.163941-154-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Arnd Bergmann [ Upstream commit ade7db991b47ab3016a414468164f4966bd08202 ] 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=3Darray-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 Signed-off-by: Steve French Signed-off-by: Sasha Levin --- 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 0c92af11f4f4..8632380d2b94 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -6421,9 +6421,7 @@ SetEARetry: pSMB->InformationLevel =3D cpu_to_le16(SMB_SET_FILE_EA); =20 - parm_data =3D - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data =3D (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset; pSMB->ParameterOffset =3D cpu_to_le16(param_offset); pSMB->DataOffset =3D cpu_to_le16(offset); pSMB->SetupCount =3D 1; --=20 2.15.1