]> git.baikalelectronics.ru Git - kernel.git/commit
fs/cifs: suppress a string overflow warning
authorStephen Rothwell <sfr@canb.auug.org.au>
Mon, 3 Sep 2018 03:15:58 +0000 (13:15 +1000)
committerSteve French <stfrench@microsoft.com>
Sun, 9 Sep 2018 05:02:39 +0000 (00:02 -0500)
commitbc847876d41b79d31e42caebfb37963a9997611f
treeb3a78072e07985287bd889ca96ad30da6a21ffd4
parente6eb0bbb5e885f25be53d7879042b8d5d5f54e5f
fs/cifs: suppress a string overflow warning

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@canb.auug.org.au>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifssmb.c