Subject: Re: [PATCH] net: Allow any address multicast join for IP sockets

From: kernel test robot <[email-masked]>
Date: Tue, 6 Jul 2021 13:18:54 +0800

Hi Callum,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.13 next-20210701]
[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]

url:    https://github.com/0day-ci/linux/commits/Callum-Sinclair/net-Allow-any-address-multicast-join-for-IP-sockets/20210706-091734
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 79160a603bdb51916226caf4a6616cc4e1c58a58
config: x86_64-randconfig-b001-20210705 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 873e8b96b1226d64e4f95083147d8592ba7bd5d8)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/b05967ad8bde7d374f6cf6f2b8bebe12828c480c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Callum-Sinclair/net-Allow-any-address-multicast-join-for-IP-sockets/20210706-091734
        git checkout b05967ad8bde7d374f6cf6f2b8bebe12828c480c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

>> net/ipv4/igmp.c:1422:6: warning: variable 'im' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (mc_hash) {
               ^~~~~~~
   net/ipv4/igmp.c:1432:9: note: uninitialized use occurs here
           return im;
                  ^~
   net/ipv4/igmp.c:1422:2: note: remove the 'if' if its condition is always true
           if (mc_hash) {
           ^~~~~~~~~~~~~
   net/ipv4/igmp.c:1419:23: note: initialize the variable 'im' to silence this warning
           struct ip_mc_list *im;
                                ^
                                 = NULL
   net/ipv4/igmp.c:1917:6: warning: variable 'changerec' set but not used [-Wunused-but-set-variable]
           int     changerec = 0;
                   ^
   2 warnings generated.

vim +1422 net/ipv4/igmp.c

  1415	
  1416	static struct ip_mc_list *ip_mc_hash_lookup(struct ip_mc_list __rcu **mc_hash,
  1417						    __be32 mc_addr)
  1418	{
  1419		struct ip_mc_list *im;
  1420		u32 hash;
  1421	
> 1422		if (mc_hash) {
  1423			hash = hash_32((__force u32)mc_addr, MC_HASH_SZ_LOG);
  1424			for (im = rcu_dereference(mc_hash[hash]);
  1425			     im != NULL;
  1426			     im = rcu_dereference(im->next_hash)) {
  1427				if (im->multiaddr == mc_addr)
  1428					break;
  1429				}
  1430		}
  1431	
  1432		return im;
  1433	}
  1434	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]