Re: [PATCH 06/11] cifs: fix sockaddr comparison in iface_cmp

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

 



Hi Shyam,

I love your patch! Yet something to improve:

[auto build test ERROR on cifs/for-next]
[also build test ERROR on linus/master v6.3-rc1 next-20230310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shyam-Prasad-N/cifs-generate-signkey-for-the-channel-that-s-reconnecting/20230310-234711
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
patch link:    https://lore.kernel.org/r/20230310153211.10982-6-sprasad%40microsoft.com
patch subject: [PATCH 06/11] cifs: fix sockaddr comparison in iface_cmp
config: x86_64-randconfig-a001 (https://download.01.org/0day-ci/archive/20230311/202303111213.VsaCo9Ff-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/799e15f02b7da48acdde0b568eef1deb23aa32ed
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Shyam-Prasad-N/cifs-generate-signkey-for-the-channel-that-s-reconnecting/20230310-234711
        git checkout 799e15f02b7da48acdde0b568eef1deb23aa32ed
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/cifs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303111213.VsaCo9Ff-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

>> fs/cifs/connect.c:1311:4: error: expected expression
                           struct sockaddr_in *saddr4 = (struct sockaddr_in *)srcaddr;
                           ^
>> fs/cifs/connect.c:1313:19: error: use of undeclared identifier 'saddr4'; did you mean 'vaddr4'?
                           return memcmp(&saddr4->sin_addr.s_addr,
                                          ^~~~~~
                                          vaddr4
   fs/cifs/connect.c:1312:24: note: 'vaddr4' declared here
                           struct sockaddr_in *vaddr4 = (struct sockaddr_in *)rhs;
                                               ^
>> fs/cifs/connect.c:1312:24: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
                           struct sockaddr_in *vaddr4 = (struct sockaddr_in *)rhs;
                                               ^
   fs/cifs/connect.c:1328:4: error: expected expression
                           struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
                           ^
>> fs/cifs/connect.c:1330:19: error: use of undeclared identifier 'saddr6'; did you mean 'vaddr6'?
                           return memcmp(&saddr6->sin6_addr,
                                          ^~~~~~
                                          vaddr6
   fs/cifs/connect.c:1329:25: note: 'vaddr6' declared here
                           struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
                                                ^
   fs/cifs/connect.c:1329:25: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
                           struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
                                                ^
   2 warnings and 4 errors generated.


vim +1311 fs/cifs/connect.c

  1291	
  1292	int
  1293	cifs_ipaddr_cmp(struct sockaddr *srcaddr, struct sockaddr *rhs)
  1294	{
  1295		switch (srcaddr->sa_family) {
  1296		case AF_UNSPEC:
  1297			switch (rhs->sa_family) {
  1298			case AF_UNSPEC:
  1299				return 0;
  1300			case AF_INET:
  1301			case AF_INET6:
  1302				return 1;
  1303			default:
  1304				return -1;
  1305			}
  1306		case AF_INET: {
  1307			switch (rhs->sa_family) {
  1308			case AF_UNSPEC:
  1309				return -1;
  1310			case AF_INET:
> 1311				struct sockaddr_in *saddr4 = (struct sockaddr_in *)srcaddr;
> 1312				struct sockaddr_in *vaddr4 = (struct sockaddr_in *)rhs;
> 1313				return memcmp(&saddr4->sin_addr.s_addr,
  1314				       &vaddr4->sin_addr.s_addr,
  1315				       sizeof(struct sockaddr_in));
  1316			case AF_INET6:
  1317				return 1;
  1318			default:
  1319				return -1;
  1320			}
  1321		}
  1322		case AF_INET6: {
  1323			switch (rhs->sa_family) {
  1324			case AF_UNSPEC:
  1325			case AF_INET:
  1326				return -1;
  1327			case AF_INET6:
  1328				struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
  1329				struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
> 1330				return memcmp(&saddr6->sin6_addr,
  1331					      &vaddr6->sin6_addr,
  1332					      sizeof(struct sockaddr_in6));
  1333			default:
  1334				return -1;
  1335			}
  1336		}
  1337		default:
  1338			return -1; /* don't expect to be here */
  1339		}
  1340	}
  1341	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux