[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201711211000.XwIRhs05%fengguang.wu@intel.com>
Date: Tue, 21 Nov 2017 10:50:06 +0800
From: kbuild test robot <lkp@...el.com>
To: yuan linyu <cugyly@....com>
Cc: kbuild-all@...org, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
Subject: Re: [PATCH net-next] netlink: optimize err assignment
Hi yuan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/yuan-linyu/netlink-optimize-err-assignment/20171121-100409
config: i386-randconfig-x001-201747 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
net/netlink/af_netlink.c: In function 'netlink_setsockopt':
>> net/netlink/af_netlink.c:1614:19: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!val || val - 1 >= nlk->ngroups)
~~~~^~~
vim +/val +1614 net/netlink/af_netlink.c
84659eb52 Johannes Berg 2007-07-18 1584
9a4595bc7 Patrick McHardy 2005-08-15 1585 static int netlink_setsockopt(struct socket *sock, int level, int optname,
b7058842c David S. Miller 2009-09-30 1586 char __user *optval, unsigned int optlen)
9a4595bc7 Patrick McHardy 2005-08-15 1587 {
9a4595bc7 Patrick McHardy 2005-08-15 1588 struct sock *sk = sock->sk;
9a4595bc7 Patrick McHardy 2005-08-15 1589 struct netlink_sock *nlk = nlk_sk(sk);
f3b56fc83 yuan linyu 2017-11-19 1590 unsigned int val;
f3b56fc83 yuan linyu 2017-11-19 1591 int err = 0;
9a4595bc7 Patrick McHardy 2005-08-15 1592
9a4595bc7 Patrick McHardy 2005-08-15 1593 if (level != SOL_NETLINK)
9a4595bc7 Patrick McHardy 2005-08-15 1594 return -ENOPROTOOPT;
9a4595bc7 Patrick McHardy 2005-08-15 1595
d1b4c689d Florian Westphal 2016-02-18 1596 if (optlen >= sizeof(int) &&
eb4965344 Johannes Berg 2007-07-18 1597 get_user(val, (unsigned int __user *)optval))
9a4595bc7 Patrick McHardy 2005-08-15 1598 return -EFAULT;
9a4595bc7 Patrick McHardy 2005-08-15 1599
9a4595bc7 Patrick McHardy 2005-08-15 1600 switch (optname) {
9a4595bc7 Patrick McHardy 2005-08-15 1601 case NETLINK_PKTINFO:
9a4595bc7 Patrick McHardy 2005-08-15 1602 if (val)
cc3a572fe Nicolas Dichtel 2015-05-07 1603 nlk->flags |= NETLINK_F_RECV_PKTINFO;
9a4595bc7 Patrick McHardy 2005-08-15 1604 else
cc3a572fe Nicolas Dichtel 2015-05-07 1605 nlk->flags &= ~NETLINK_F_RECV_PKTINFO;
9a4595bc7 Patrick McHardy 2005-08-15 1606 break;
9a4595bc7 Patrick McHardy 2005-08-15 1607 case NETLINK_ADD_MEMBERSHIP:
9a4595bc7 Patrick McHardy 2005-08-15 1608 case NETLINK_DROP_MEMBERSHIP: {
5187cd055 Eric W. Biederman 2014-04-23 1609 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
9a4595bc7 Patrick McHardy 2005-08-15 1610 return -EPERM;
b4ff4f041 Johannes Berg 2007-07-18 1611 err = netlink_realloc_groups(sk);
513c25000 Patrick McHardy 2005-09-06 1612 if (err)
513c25000 Patrick McHardy 2005-09-06 1613 return err;
9a4595bc7 Patrick McHardy 2005-08-15 @1614 if (!val || val - 1 >= nlk->ngroups)
9a4595bc7 Patrick McHardy 2005-08-15 1615 return -EINVAL;
7774d5e03 Richard Guy Briggs 2014-04-22 1616 if (optname == NETLINK_ADD_MEMBERSHIP && nlk->netlink_bind) {
023e2cfa3 Johannes Berg 2014-12-23 1617 err = nlk->netlink_bind(sock_net(sk), val);
4f5209005 Richard Guy Briggs 2014-04-22 1618 if (err)
4f5209005 Richard Guy Briggs 2014-04-22 1619 return err;
4f5209005 Richard Guy Briggs 2014-04-22 1620 }
9a4595bc7 Patrick McHardy 2005-08-15 1621 netlink_table_grab();
84659eb52 Johannes Berg 2007-07-18 1622 netlink_update_socket_mc(nlk, val,
84659eb52 Johannes Berg 2007-07-18 1623 optname == NETLINK_ADD_MEMBERSHIP);
9a4595bc7 Patrick McHardy 2005-08-15 1624 netlink_table_ungrab();
7774d5e03 Richard Guy Briggs 2014-04-22 1625 if (optname == NETLINK_DROP_MEMBERSHIP && nlk->netlink_unbind)
023e2cfa3 Johannes Berg 2014-12-23 1626 nlk->netlink_unbind(sock_net(sk), val);
9a4595bc7 Patrick McHardy 2005-08-15 1627 break;
9a4595bc7 Patrick McHardy 2005-08-15 1628 }
be0c22a46 Pablo Neira Ayuso 2009-02-18 1629 case NETLINK_BROADCAST_ERROR:
be0c22a46 Pablo Neira Ayuso 2009-02-18 1630 if (val)
cc3a572fe Nicolas Dichtel 2015-05-07 1631 nlk->flags |= NETLINK_F_BROADCAST_SEND_ERROR;
be0c22a46 Pablo Neira Ayuso 2009-02-18 1632 else
cc3a572fe Nicolas Dichtel 2015-05-07 1633 nlk->flags &= ~NETLINK_F_BROADCAST_SEND_ERROR;
be0c22a46 Pablo Neira Ayuso 2009-02-18 1634 break;
38938bfe3 Pablo Neira Ayuso 2009-03-24 1635 case NETLINK_NO_ENOBUFS:
38938bfe3 Pablo Neira Ayuso 2009-03-24 1636 if (val) {
cc3a572fe Nicolas Dichtel 2015-05-07 1637 nlk->flags |= NETLINK_F_RECV_NO_ENOBUFS;
cc3a572fe Nicolas Dichtel 2015-05-07 1638 clear_bit(NETLINK_S_CONGESTED, &nlk->state);
38938bfe3 Pablo Neira Ayuso 2009-03-24 1639 wake_up_interruptible(&nlk->wait);
658cb354e Eric Dumazet 2012-04-22 1640 } else {
cc3a572fe Nicolas Dichtel 2015-05-07 1641 nlk->flags &= ~NETLINK_F_RECV_NO_ENOBUFS;
658cb354e Eric Dumazet 2012-04-22 1642 }
38938bfe3 Pablo Neira Ayuso 2009-03-24 1643 break;
59324cf35 Nicolas Dichtel 2015-05-07 1644 case NETLINK_LISTEN_ALL_NSID:
59324cf35 Nicolas Dichtel 2015-05-07 1645 if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_BROADCAST))
59324cf35 Nicolas Dichtel 2015-05-07 1646 return -EPERM;
59324cf35 Nicolas Dichtel 2015-05-07 1647
59324cf35 Nicolas Dichtel 2015-05-07 1648 if (val)
59324cf35 Nicolas Dichtel 2015-05-07 1649 nlk->flags |= NETLINK_F_LISTEN_ALL_NSID;
59324cf35 Nicolas Dichtel 2015-05-07 1650 else
59324cf35 Nicolas Dichtel 2015-05-07 1651 nlk->flags &= ~NETLINK_F_LISTEN_ALL_NSID;
59324cf35 Nicolas Dichtel 2015-05-07 1652 break;
0a6a3a23e Christophe Ricard 2015-08-28 1653 case NETLINK_CAP_ACK:
0a6a3a23e Christophe Ricard 2015-08-28 1654 if (val)
0a6a3a23e Christophe Ricard 2015-08-28 1655 nlk->flags |= NETLINK_F_CAP_ACK;
0a6a3a23e Christophe Ricard 2015-08-28 1656 else
0a6a3a23e Christophe Ricard 2015-08-28 1657 nlk->flags &= ~NETLINK_F_CAP_ACK;
0a6a3a23e Christophe Ricard 2015-08-28 1658 break;
2d4bc9336 Johannes Berg 2017-04-12 1659 case NETLINK_EXT_ACK:
2d4bc9336 Johannes Berg 2017-04-12 1660 if (val)
2d4bc9336 Johannes Berg 2017-04-12 1661 nlk->flags |= NETLINK_F_EXT_ACK;
2d4bc9336 Johannes Berg 2017-04-12 1662 else
2d4bc9336 Johannes Berg 2017-04-12 1663 nlk->flags &= ~NETLINK_F_EXT_ACK;
2d4bc9336 Johannes Berg 2017-04-12 1664 break;
9a4595bc7 Patrick McHardy 2005-08-15 1665 default:
9a4595bc7 Patrick McHardy 2005-08-15 1666 err = -ENOPROTOOPT;
9a4595bc7 Patrick McHardy 2005-08-15 1667 }
9a4595bc7 Patrick McHardy 2005-08-15 1668 return err;
9a4595bc7 Patrick McHardy 2005-08-15 1669 }
9a4595bc7 Patrick McHardy 2005-08-15 1670
:::::: The code at line 1614 was first introduced by commit
:::::: 9a4595bc7e67962f13232ee55a64e063062c3a99 [NETLINK]: Add set/getsockopt options to support more than 32 groups
:::::: TO: Patrick McHardy <kaber@...sh.net>
:::::: CC: David S. Miller <davem@...set.davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (32042 bytes)
Powered by blists - more mailing lists