Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3

From: Geert Uytterhoeven
Date: Fri Feb 07 2020 - 03:12:40 EST


Hi Steve,

On Thu, 6 Feb 2020, Steve French wrote:
ok - changed as suggested. Tested out ok

From ab3459d8f0ef52c38119ed58c4c29139efc7022c Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Thu, 6 Feb 2020 17:31:56 -0600
Subject: [PATCH 1/2] smb3: print warning once if posix context returned on
open

SMB3.1.1 POSIX Context processing is not complete yet - so print warning
(once) if server returns it on open.

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
Reviewed-by: Aurelien Aptel <aaptel@xxxxxxxx>
---
fs/cifs/smb2pdu.c | 22 ++++++++++++++++++++++
fs/cifs/smb2pdu.h | 8 ++++++++
2 files changed, 30 insertions(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 47cce0bd1afe..1234f9ccab03 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1950,6 +1960,9 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
unsigned int next;
unsigned int remaining;
char *name;
+ const char smb3_create_tag_posix[] = {0x93, 0xAD, 0x25, 0x50, 0x9C,
+ 0xB4, 0x11, 0xE7, 0xB4, 0x23, 0x83,
+ 0xDE, 0x96, 0x8B, 0xCD, 0x7C};

Given this data is used in 2 other places, you may want to make it
global, and use it in build_posix_ctxt() and create_posix_buf(), too.

On Thu, Feb 6, 2020 at 5:16 PM ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote:

It is probably that m68k lage quite behind in GCC versions and
probably that compiler can not handle this construct:
1983 if (memcmp(name, (char []) {0x93, 0xAD, 0x25, 0x50,
1984 0x9C, 0xB4, 0x11, 0xE7, 0xB4,
0x23, 0x83,
1985 0xDE, 0x96, 0x8B, 0xCD, 0x7C}, 16) == 0)
and you would probably need something like this:
const char foo[] = {0x93, 0xAD, 0x25, 0x50, 0x9C, 0xB4, 0x11,
0xE7, 0xB4, 0x23, 0x83, 0xDE, 0x96, 0x8B, 0xCD, 0x7C};
if (memcmp(name, foo, sizeof(foo)) == 0)
...

This is not related to compiler version (I can trigger it with a small
test program on gcc-7 and gcc-8 on amd64), but due to the use of a
macro in arch/m68k/include/asm/string.h for providing memset():

#define memset(d, c, n) __builtin_memset(d, c, n)

As several other architectures do to the same (even x86, depending on
config options and other parameters), I guess it can be triggered there
as well.

On Fri, Feb 7, 2020 at 8:48 AM Steve French <smfrench@xxxxxxxxx> wrote:

It compiled and tested ok. Is this warning a limitation of the kbuild robot?

On Thu, Feb 6, 2020 at 4:26 PM kbuild test robot <lkp@xxxxxxxxx> wrote:

tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: 58b322cfd219fd570d4fcc2e2eb8b5d945389d46
commit: 3d9d8c48232a668ada5f680f70c8b3d366629ab6 [10/11] smb3: print warning once if posix context returned on open
config: m68k-multi_defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3d9d8c48232a668ada5f680f70c8b3d366629ab6
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

fs/cifs/smb2pdu.c: In function 'smb2_parse_contexts':
fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
0xDE, 0x96, 0x8B, 0xCD, 0x7C}, 16) == 0)
^
fs/cifs/smb2pdu.c:1983:8: error: 'memcmp' undeclared (first use in this function); did you mean 'memchr'?
if (memcmp(name, (char []) {0x93, 0xAD, 0x25, 0x50,
^~~~~~
memchr
fs/cifs/smb2pdu.c:1983:8: note: each undeclared identifier is reported only once for each function it appears in


Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds