[PATCH] wireguard: netlink: add multicast notification for peer changes

kernel test robot lkp at intel.com
Mon Jan 11 20:48:49 UTC 2021


Hi Linus,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11-rc3 next-20210111]
[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/Linus-Lotz/wireguard-netlink-add-multicast-notification-for-peer-changes/20210110-051531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 996e435fd401de35df62ac943ab9402cfe85c430
config: x86_64-randconfig-a013-20210111 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7be3285248bf54d0784a76174cf44cf7c1e780a5)
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/3f394635e584429ebbadfbf315c0fe4e2d36b583
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Linus-Lotz/wireguard-netlink-add-multicast-notification-for-peer-changes/20210110-051531
        git checkout 3f394635e584429ebbadfbf315c0fe4e2d36b583
        # 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 <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/wireguard/netlink.c:675:11: warning: variable 'fail' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (peer->endpoint.addr.sa_family == AF_INET6)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireguard/netlink.c:680:6: note: uninitialized use occurs here
           if (fail)
               ^~~~
   drivers/net/wireguard/netlink.c:675:7: note: remove the 'if' if its condition is always true
           else if (peer->endpoint.addr.sa_family == AF_INET6)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireguard/netlink.c:654:10: note: initialize the variable 'fail' to silence this warning
           int fail;
                   ^
                    = 0
   1 warning generated.


vim +675 drivers/net/wireguard/netlink.c

   649	
   650	int wg_genl_mcast_peer_endpoint_change(struct wg_peer *peer)
   651	{
   652		struct sk_buff *skb;
   653		void *hdr, *peer_nest, *peer_array_nest;
   654		int fail;
   655	
   656		skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
   657		hdr = genlmsg_put(skb, 0, 0,
   658				  &genl_family, 0, WG_CMD_CHANGED_PEER);
   659	
   660		nla_put_u32(skb, WGDEVICE_A_IFINDEX, peer->device->dev->ifindex);
   661		nla_put_string(skb, WGDEVICE_A_IFNAME, peer->device->dev->name);
   662	
   663		peer_nest = nla_nest_start(skb, WGDEVICE_A_PEERS);
   664		peer_array_nest = nla_nest_start(skb, 0);
   665		down_read(&peer->handshake.lock);
   666		nla_put(skb, WGPEER_A_PUBLIC_KEY, NOISE_PUBLIC_KEY_LEN,
   667			peer->handshake.remote_static);
   668		up_read(&peer->handshake.lock);
   669	
   670		read_lock_bh(&peer->endpoint_lock);
   671		if (peer->endpoint.addr.sa_family == AF_INET)
   672			fail = nla_put(skb, WGPEER_A_ENDPOINT,
   673				       sizeof(peer->endpoint.addr4),
   674				       &peer->endpoint.addr4);
 > 675		else if (peer->endpoint.addr.sa_family == AF_INET6)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32150 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20210112/942ea5c6/attachment.gz>


More information about the WireGuard mailing list