linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
@ 2020-02-06 22:26 kbuild test robot
  2020-02-06 22:47 ` Steve French
  0 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2020-02-06 22:26 UTC (permalink / raw)
  To: Steve French; +Cc: kbuild-all, linux-cifs, samba-technical, Aurelien Aptel

[-- Attachment #1: Type: text/plain, Size: 3499 bytes --]

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@intel.com>

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

vim +/memcmp +1985 fs/cifs/smb2pdu.c

  1951	
  1952	void
  1953	smb2_parse_contexts(struct TCP_Server_Info *server,
  1954			       struct smb2_create_rsp *rsp,
  1955			       unsigned int *epoch, char *lease_key, __u8 *oplock,
  1956			       struct smb2_file_all_info *buf)
  1957	{
  1958		char *data_offset;
  1959		struct create_context *cc;
  1960		unsigned int next;
  1961		unsigned int remaining;
  1962		char *name;
  1963	
  1964		*oplock = 0;
  1965		data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
  1966		remaining = le32_to_cpu(rsp->CreateContextsLength);
  1967		cc = (struct create_context *)data_offset;
  1968	
  1969		/* Initialize inode number to 0 in case no valid data in qfid context */
  1970		if (buf)
  1971			buf->IndexNumber = 0;
  1972	
  1973		while (remaining >= sizeof(struct create_context)) {
  1974			name = le16_to_cpu(cc->NameOffset) + (char *)cc;
  1975			if (le16_to_cpu(cc->NameLength) == 4 &&
  1976			    strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
  1977				*oplock = server->ops->parse_lease_buf(cc, epoch,
  1978								   lease_key);
  1979			else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
  1980			    strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
  1981				parse_query_id_ctxt(cc, buf);
  1982			else if ((le16_to_cpu(cc->NameLength) == 16)) {
> 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)
  1986					parse_posix_ctxt(cc, NULL);
  1987			}
  1988			/* else {
  1989				cifs_dbg(FYI, "Context not matched with len %d\n",
  1990					le16_to_cpu(cc->NameLength));
  1991				cifs_dump_mem("Cctxt name: ", name, 4);
  1992			} */
  1993	
  1994			next = le32_to_cpu(cc->Next);
  1995			if (!next)
  1996				break;
  1997			remaining -= next;
  1998			cc = (struct create_context *)((char *)cc + next);
  1999		}
  2000	
  2001		if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
  2002			*oplock = rsp->OplockLevel;
  2003	
  2004		return;
  2005	}
  2006	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 16863 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
  2020-02-06 22:26 [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3 kbuild test robot
@ 2020-02-06 22:47 ` Steve French
  2020-02-06 23:16   ` ronnie sahlberg
  0 siblings, 1 reply; 6+ messages in thread
From: Steve French @ 2020-02-06 22:47 UTC (permalink / raw)
  To: kbuild test robot; +Cc: CIFS, Aurélien Aptel

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@intel.com> 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@intel.com>
>
> 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
>
> vim +/memcmp +1985 fs/cifs/smb2pdu.c
>
>   1951
>   1952  void
>   1953  smb2_parse_contexts(struct TCP_Server_Info *server,
>   1954                         struct smb2_create_rsp *rsp,
>   1955                         unsigned int *epoch, char *lease_key, __u8 *oplock,
>   1956                         struct smb2_file_all_info *buf)
>   1957  {
>   1958          char *data_offset;
>   1959          struct create_context *cc;
>   1960          unsigned int next;
>   1961          unsigned int remaining;
>   1962          char *name;
>   1963
>   1964          *oplock = 0;
>   1965          data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
>   1966          remaining = le32_to_cpu(rsp->CreateContextsLength);
>   1967          cc = (struct create_context *)data_offset;
>   1968
>   1969          /* Initialize inode number to 0 in case no valid data in qfid context */
>   1970          if (buf)
>   1971                  buf->IndexNumber = 0;
>   1972
>   1973          while (remaining >= sizeof(struct create_context)) {
>   1974                  name = le16_to_cpu(cc->NameOffset) + (char *)cc;
>   1975                  if (le16_to_cpu(cc->NameLength) == 4 &&
>   1976                      strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
>   1977                          *oplock = server->ops->parse_lease_buf(cc, epoch,
>   1978                                                             lease_key);
>   1979                  else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
>   1980                      strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
>   1981                          parse_query_id_ctxt(cc, buf);
>   1982                  else if ((le16_to_cpu(cc->NameLength) == 16)) {
> > 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)
>   1986                                  parse_posix_ctxt(cc, NULL);
>   1987                  }
>   1988                  /* else {
>   1989                          cifs_dbg(FYI, "Context not matched with len %d\n",
>   1990                                  le16_to_cpu(cc->NameLength));
>   1991                          cifs_dump_mem("Cctxt name: ", name, 4);
>   1992                  } */
>   1993
>   1994                  next = le32_to_cpu(cc->Next);
>   1995                  if (!next)
>   1996                          break;
>   1997                  remaining -= next;
>   1998                  cc = (struct create_context *)((char *)cc + next);
>   1999          }
>   2000
>   2001          if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
>   2002                  *oplock = rsp->OplockLevel;
>   2003
>   2004          return;
>   2005  }
>   2006
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
  2020-02-06 22:47 ` Steve French
@ 2020-02-06 23:16   ` ronnie sahlberg
  2020-02-06 23:33     ` Steve French
  0 siblings, 1 reply; 6+ messages in thread
From: ronnie sahlberg @ 2020-02-06 23:16 UTC (permalink / raw)
  To: Steve French; +Cc: kbuild test robot, CIFS, Aurélien Aptel

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)
...

On Fri, Feb 7, 2020 at 8:48 AM Steve French <smfrench@gmail.com> 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@intel.com> 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@intel.com>
> >
> > 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
> >
> > vim +/memcmp +1985 fs/cifs/smb2pdu.c
> >
> >   1951
> >   1952  void
> >   1953  smb2_parse_contexts(struct TCP_Server_Info *server,
> >   1954                         struct smb2_create_rsp *rsp,
> >   1955                         unsigned int *epoch, char *lease_key, __u8 *oplock,
> >   1956                         struct smb2_file_all_info *buf)
> >   1957  {
> >   1958          char *data_offset;
> >   1959          struct create_context *cc;
> >   1960          unsigned int next;
> >   1961          unsigned int remaining;
> >   1962          char *name;
> >   1963
> >   1964          *oplock = 0;
> >   1965          data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
> >   1966          remaining = le32_to_cpu(rsp->CreateContextsLength);
> >   1967          cc = (struct create_context *)data_offset;
> >   1968
> >   1969          /* Initialize inode number to 0 in case no valid data in qfid context */
> >   1970          if (buf)
> >   1971                  buf->IndexNumber = 0;
> >   1972
> >   1973          while (remaining >= sizeof(struct create_context)) {
> >   1974                  name = le16_to_cpu(cc->NameOffset) + (char *)cc;
> >   1975                  if (le16_to_cpu(cc->NameLength) == 4 &&
> >   1976                      strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
> >   1977                          *oplock = server->ops->parse_lease_buf(cc, epoch,
> >   1978                                                             lease_key);
> >   1979                  else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
> >   1980                      strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
> >   1981                          parse_query_id_ctxt(cc, buf);
> >   1982                  else if ((le16_to_cpu(cc->NameLength) == 16)) {
> > > 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)
> >   1986                                  parse_posix_ctxt(cc, NULL);
> >   1987                  }
> >   1988                  /* else {
> >   1989                          cifs_dbg(FYI, "Context not matched with len %d\n",
> >   1990                                  le16_to_cpu(cc->NameLength));
> >   1991                          cifs_dump_mem("Cctxt name: ", name, 4);
> >   1992                  } */
> >   1993
> >   1994                  next = le32_to_cpu(cc->Next);
> >   1995                  if (!next)
> >   1996                          break;
> >   1997                  remaining -= next;
> >   1998                  cc = (struct create_context *)((char *)cc + next);
> >   1999          }
> >   2000
> >   2001          if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
> >   2002                  *oplock = rsp->OplockLevel;
> >   2003
> >   2004          return;
> >   2005  }
> >   2006
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
>
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
  2020-02-06 23:16   ` ronnie sahlberg
@ 2020-02-06 23:33     ` Steve French
  2020-02-07  0:34       ` ronnie sahlberg
  2020-02-07  8:12       ` Geert Uytterhoeven
  0 siblings, 2 replies; 6+ messages in thread
From: Steve French @ 2020-02-06 23:33 UTC (permalink / raw)
  To: ronnie sahlberg
  Cc: kbuild test robot, CIFS, Aurélien Aptel, samba-technical,
	Pavel Shilovsky

[-- Attachment #1: Type: text/plain, Size: 5772 bytes --]

ok - changed as suggested. Tested out ok

See attached.

On Thu, Feb 6, 2020 at 5:16 PM ronnie sahlberg <ronniesahlberg@gmail.com> 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)
> ...
>
> On Fri, Feb 7, 2020 at 8:48 AM Steve French <smfrench@gmail.com> 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@intel.com> 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@intel.com>
> > >
> > > 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
> > >
> > > vim +/memcmp +1985 fs/cifs/smb2pdu.c
> > >
> > >   1951
> > >   1952  void
> > >   1953  smb2_parse_contexts(struct TCP_Server_Info *server,
> > >   1954                         struct smb2_create_rsp *rsp,
> > >   1955                         unsigned int *epoch, char *lease_key, __u8 *oplock,
> > >   1956                         struct smb2_file_all_info *buf)
> > >   1957  {
> > >   1958          char *data_offset;
> > >   1959          struct create_context *cc;
> > >   1960          unsigned int next;
> > >   1961          unsigned int remaining;
> > >   1962          char *name;
> > >   1963
> > >   1964          *oplock = 0;
> > >   1965          data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
> > >   1966          remaining = le32_to_cpu(rsp->CreateContextsLength);
> > >   1967          cc = (struct create_context *)data_offset;
> > >   1968
> > >   1969          /* Initialize inode number to 0 in case no valid data in qfid context */
> > >   1970          if (buf)
> > >   1971                  buf->IndexNumber = 0;
> > >   1972
> > >   1973          while (remaining >= sizeof(struct create_context)) {
> > >   1974                  name = le16_to_cpu(cc->NameOffset) + (char *)cc;
> > >   1975                  if (le16_to_cpu(cc->NameLength) == 4 &&
> > >   1976                      strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
> > >   1977                          *oplock = server->ops->parse_lease_buf(cc, epoch,
> > >   1978                                                             lease_key);
> > >   1979                  else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
> > >   1980                      strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
> > >   1981                          parse_query_id_ctxt(cc, buf);
> > >   1982                  else if ((le16_to_cpu(cc->NameLength) == 16)) {
> > > > 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)
> > >   1986                                  parse_posix_ctxt(cc, NULL);
> > >   1987                  }
> > >   1988                  /* else {
> > >   1989                          cifs_dbg(FYI, "Context not matched with len %d\n",
> > >   1990                                  le16_to_cpu(cc->NameLength));
> > >   1991                          cifs_dump_mem("Cctxt name: ", name, 4);
> > >   1992                  } */
> > >   1993
> > >   1994                  next = le32_to_cpu(cc->Next);
> > >   1995                  if (!next)
> > >   1996                          break;
> > >   1997                  remaining -= next;
> > >   1998                  cc = (struct create_context *)((char *)cc + next);
> > >   1999          }
> > >   2000
> > >   2001          if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
> > >   2002                  *oplock = rsp->OplockLevel;
> > >   2003
> > >   2004          return;
> > >   2005  }
> > >   2006
> > >
> > > ---
> > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve



-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-print-warning-once-if-posix-context-returned-on.patch --]
[-- Type: text/x-patch, Size: 2676 bytes --]

From ab3459d8f0ef52c38119ed58c4c29139efc7022c Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
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@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
---
 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
@@ -1939,6 +1939,16 @@ parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf)
 	buf->IndexNumber = pdisk_id->DiskFileId;
 }
 
+static void
+parse_posix_ctxt(struct create_context *cc, struct smb_posix_info *pposix_inf)
+{
+	/* struct smb_posix_info *ppinf = (struct smb_posix_info *)cc; */
+
+	/* TODO: Need to add parsing for the context and return */
+	printk_once(KERN_WARNING
+		    "SMB3 3.11 POSIX response context not completed yet\n");
+}
+
 void
 smb2_parse_contexts(struct TCP_Server_Info *server,
 		       struct smb2_create_rsp *rsp,
@@ -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};
 
 	*oplock = 0;
 	data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
@@ -1969,6 +1982,15 @@ smb2_parse_contexts(struct TCP_Server_Info *server,
 		else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
 		    strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
 			parse_query_id_ctxt(cc, buf);
+		else if ((le16_to_cpu(cc->NameLength) == 16)) {
+			if (memcmp(name, smb3_create_tag_posix, 16) == 0)
+				parse_posix_ctxt(cc, NULL);
+		}
+		/* else {
+			cifs_dbg(FYI, "Context not matched with len %d\n",
+				le16_to_cpu(cc->NameLength));
+			cifs_dump_mem("Cctxt name: ", name, 4);
+		} */
 
 		next = le32_to_cpu(cc->Next);
 		if (!next)
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 4c43dbd1e089..ca2123d7f199 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -1595,4 +1595,12 @@ struct smb2_file_network_open_info {
 
 extern char smb2_padding[7];
 
+/* equivalent of the contents of SMB3.1.1 POSIX open context response */
+struct smb_posix_info {
+	__le32 nlink;
+	__le32 reparse_tag;
+	__le32 mode;
+	kuid_t	uid;
+	kuid_t	gid;
+};
 #endif				/* _SMB2PDU_H */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
  2020-02-06 23:33     ` Steve French
@ 2020-02-07  0:34       ` ronnie sahlberg
  2020-02-07  8:12       ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: ronnie sahlberg @ 2020-02-07  0:34 UTC (permalink / raw)
  To: Steve French
  Cc: kbuild test robot, CIFS, Aurélien Aptel, samba-technical,
	Pavel Shilovsky

Looks good to me.
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>

On Fri, Feb 7, 2020 at 9:33 AM Steve French <smfrench@gmail.com> wrote:
>
> ok - changed as suggested. Tested out ok
>
> See attached.
>
> On Thu, Feb 6, 2020 at 5:16 PM ronnie sahlberg <ronniesahlberg@gmail.com> 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)
> > ...
> >
> > On Fri, Feb 7, 2020 at 8:48 AM Steve French <smfrench@gmail.com> 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@intel.com> 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@intel.com>
> > > >
> > > > 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
> > > >
> > > > vim +/memcmp +1985 fs/cifs/smb2pdu.c
> > > >
> > > >   1951
> > > >   1952  void
> > > >   1953  smb2_parse_contexts(struct TCP_Server_Info *server,
> > > >   1954                         struct smb2_create_rsp *rsp,
> > > >   1955                         unsigned int *epoch, char *lease_key, __u8 *oplock,
> > > >   1956                         struct smb2_file_all_info *buf)
> > > >   1957  {
> > > >   1958          char *data_offset;
> > > >   1959          struct create_context *cc;
> > > >   1960          unsigned int next;
> > > >   1961          unsigned int remaining;
> > > >   1962          char *name;
> > > >   1963
> > > >   1964          *oplock = 0;
> > > >   1965          data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
> > > >   1966          remaining = le32_to_cpu(rsp->CreateContextsLength);
> > > >   1967          cc = (struct create_context *)data_offset;
> > > >   1968
> > > >   1969          /* Initialize inode number to 0 in case no valid data in qfid context */
> > > >   1970          if (buf)
> > > >   1971                  buf->IndexNumber = 0;
> > > >   1972
> > > >   1973          while (remaining >= sizeof(struct create_context)) {
> > > >   1974                  name = le16_to_cpu(cc->NameOffset) + (char *)cc;
> > > >   1975                  if (le16_to_cpu(cc->NameLength) == 4 &&
> > > >   1976                      strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
> > > >   1977                          *oplock = server->ops->parse_lease_buf(cc, epoch,
> > > >   1978                                                             lease_key);
> > > >   1979                  else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
> > > >   1980                      strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
> > > >   1981                          parse_query_id_ctxt(cc, buf);
> > > >   1982                  else if ((le16_to_cpu(cc->NameLength) == 16)) {
> > > > > 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)
> > > >   1986                                  parse_posix_ctxt(cc, NULL);
> > > >   1987                  }
> > > >   1988                  /* else {
> > > >   1989                          cifs_dbg(FYI, "Context not matched with len %d\n",
> > > >   1990                                  le16_to_cpu(cc->NameLength));
> > > >   1991                          cifs_dump_mem("Cctxt name: ", name, 4);
> > > >   1992                  } */
> > > >   1993
> > > >   1994                  next = le32_to_cpu(cc->Next);
> > > >   1995                  if (!next)
> > > >   1996                          break;
> > > >   1997                  remaining -= next;
> > > >   1998                  cc = (struct create_context *)((char *)cc + next);
> > > >   1999          }
> > > >   2000
> > > >   2001          if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
> > > >   2002                  *oplock = rsp->OplockLevel;
> > > >   2003
> > > >   2004          return;
> > > >   2005  }
> > > >   2006
> > > >
> > > > ---
> > > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> > >
> > >
> > >
> > > --
> > > Thanks,
> > >
> > > Steve
>
>
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3
  2020-02-06 23:33     ` Steve French
  2020-02-07  0:34       ` ronnie sahlberg
@ 2020-02-07  8:12       ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2020-02-07  8:12 UTC (permalink / raw)
  To: Steve French
  Cc: ronnie sahlberg, kbuild test robot, CIFS, Aurélien Aptel,
	samba-technical, Pavel Shilovsky, linux-kernel

 	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@microsoft.com>
> 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@microsoft.com>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> ---
>  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@gmail.com> 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@gmail.com> 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@intel.com> 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@intel.com>
>>>>
>>>> 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@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-07  8:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 22:26 [cifs:for-next 10/11] fs/cifs/smb2pdu.c:1985:38: error: macro "memcmp" passed 18 arguments, but takes just 3 kbuild test robot
2020-02-06 22:47 ` Steve French
2020-02-06 23:16   ` ronnie sahlberg
2020-02-06 23:33     ` Steve French
2020-02-07  0:34       ` ronnie sahlberg
2020-02-07  8:12       ` Geert Uytterhoeven

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).