Re: [PATCH AUTOSEL 4.18 39/65] fs/cifs: suppress a string overflow warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sasha,

On Mon, 1 Oct 2018 00:38:27 +0000 Sasha Levin <Alexander.Levin@xxxxxxxxxxxxx> wrote:
>
> From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> 
> [ Upstream commit bcfb84a996f6fa90b5e6e2954b2accb7a4711097 ]
> 
> A powerpc build of cifs with gcc v8.2.0 produces this warning:
> 
> fs/cifs/cifssmb.c: In function ‘CIFSSMBNegotiate’:
> fs/cifs/cifssmb.c:605:3: warning: ‘strncpy’ writing 16 bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
>    strncpy(pSMB->DialectsArray+count, protocols[i].name, 16);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Since we are already doing a strlen() on the source, change the strncpy
> to a memcpy().
> 
> Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>

Just wondering if this should be included as it only fixes a build
warning, there is no actual bug.  Same for the 4.9 and 4.14 versions.

-- 
Cheers,
Stephen Rothwell

Attachment: pgpjFojEUXsoN.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux