All of lore.kernel.org
 help / color / mirror / Atom feed
* [jpirko-mlxsw:gearboxes 5/72] net/core/rtnetlink.c:5311:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
@ 2022-02-25 13:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-02-25 13:49 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Petr Machata <petrm@nvidia.com>
CC: Ido Schimmel <idosch@nvidia.com>

tree:   https://github.com/jpirko/linux_mlxsw gearboxes
head:   d58a6e73f8b9fad6ad13c269b9670388f242de6c
commit: ef1f07a8a52555ed2311efa7c44da698079e6278 [5/72] net: rtnetlink: rtnl_fill_statsinfo(): Permit non-EMSGSIZE error returns
:::::: branch date: 29 hours ago
:::::: commit date: 29 hours ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220225/202202252123.8OOEl3w7-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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/jpirko/linux_mlxsw/commit/ef1f07a8a52555ed2311efa7c44da698079e6278
        git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
        git fetch --no-tags jpirko-mlxsw gearboxes
        git checkout ef1f07a8a52555ed2311efa7c44da698079e6278
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   net/core/rtnetlink.c:2710:28: warning: Array access (from variable 'ifname') results in a null pointer dereference [clang-analyzer-core.NullDereference]
           if (ifm->ifi_index > 0 && ifname[0]) {
                                     ^~~~~~
   net/core/rtnetlink.c:2616:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/core/rtnetlink.c:2616:2: note: Taking false branch
           if (err < 0)
           ^
   net/core/rtnetlink.c:2619:6: note: Assuming the condition is false
           if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) {
               ^~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2619:6: note: Left side of '||' is false
   net/core/rtnetlink.c:2619:29: note: Assuming the condition is false
           if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) {
                                      ^~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2619:6: note: Left side of '||' is false
           if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) {
               ^
   net/core/rtnetlink.c:2619:51: note: Assuming the condition is true
           if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) {
                                                            ^~~~~~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2619:2: note: Taking true branch
           if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD] || tb[IFLA_TARGET_NETNSID]) {
           ^
   net/core/rtnetlink.c:2620:21: note: Assuming 'ifname' is null
                   const char *pat = ifname && ifname[0] ? ifname : NULL;
                                     ^~~~~~
   net/core/rtnetlink.c:2620:28: note: Left side of '&&' is false
                   const char *pat = ifname && ifname[0] ? ifname : NULL;
                                            ^
   net/core/rtnetlink.c:2626:7: note: Calling 'IS_ERR'
                   if (IS_ERR(net)) {
                       ^~~~~~~~~~~
   include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
           return IS_ERR_VALUE((unsigned long)ptr);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2626:7: note: Returning from 'IS_ERR'
                   if (IS_ERR(net)) {
                       ^~~~~~~~~~~
   net/core/rtnetlink.c:2626:3: note: Taking false branch
                   if (IS_ERR(net)) {
                   ^
   net/core/rtnetlink.c:2631:7: note: Assuming the condition is false
                   if (tb[IFLA_NEW_IFINDEX])
                       ^~~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2631:3: note: Taking false branch
                   if (tb[IFLA_NEW_IFINDEX])
                   ^
   net/core/rtnetlink.c:2638:7: note: Assuming 'err' is 0
                   if (err)
                       ^~~
   net/core/rtnetlink.c:2638:3: note: Taking false branch
                   if (err)
                   ^
   net/core/rtnetlink.c:2643:6: note: Assuming the condition is false
           if (tb[IFLA_MAP]) {
               ^~~~~~~~~~~~
   net/core/rtnetlink.c:2643:2: note: Taking false branch
           if (tb[IFLA_MAP]) {
           ^
   net/core/rtnetlink.c:2672:6: note: Assuming the condition is false
           if (tb[IFLA_ADDRESS]) {
               ^~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2672:2: note: Taking false branch
           if (tb[IFLA_ADDRESS]) {
           ^
   net/core/rtnetlink.c:2693:6: note: Assuming the condition is false
           if (tb[IFLA_MTU]) {
               ^~~~~~~~~~~~
   net/core/rtnetlink.c:2693:2: note: Taking false branch
           if (tb[IFLA_MTU]) {
           ^
   net/core/rtnetlink.c:2700:6: note: Assuming the condition is false
           if (tb[IFLA_GROUP]) {
               ^~~~~~~~~~~~~~
   net/core/rtnetlink.c:2700:2: note: Taking false branch
           if (tb[IFLA_GROUP]) {
           ^
   net/core/rtnetlink.c:2710:6: note: Assuming field 'ifi_index' is > 0
           if (ifm->ifi_index > 0 && ifname[0]) {
               ^~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:2710:6: note: Left side of '&&' is true
   net/core/rtnetlink.c:2710:28: note: Array access (from variable 'ifname') results in a null pointer dereference
           if (ifm->ifi_index > 0 && ifname[0]) {
                                     ^~~~~~
   net/core/rtnetlink.c:2833:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/core/rtnetlink.c:2833:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/core/rtnetlink.c:2868:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/core/rtnetlink.c:2868:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
>> net/core/rtnetlink.c:5311:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
           return err;
           ^
   net/core/rtnetlink.c:5554:6: note: 'err' is 0
           if (err)
               ^~~
   net/core/rtnetlink.c:5554:2: note: Taking false branch
           if (err)
           ^
   net/core/rtnetlink.c:5558:6: note: Assuming field 'filter_mask' is not equal to 0
           if (!ifsm->filter_mask) {
               ^~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:5558:2: note: Taking false branch
           if (!ifsm->filter_mask) {
           ^
   net/core/rtnetlink.c:5565:6: note: Assuming 'err' is 0
           if (err)
               ^~~
   net/core/rtnetlink.c:5565:2: note: Taking false branch
           if (err)
           ^
   net/core/rtnetlink.c:5568:16: note: Assuming the condition is true
           for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
                         ^~~~~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:5568:2: note: Loop condition is true.  Entering loop body
           for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
           ^
   net/core/rtnetlink.c:5571:3: note: Assuming '____ptr' is non-null
                   hlist_for_each_entry(dev, head, index_hlist) {
                   ^
   include/linux/list.h:1003:13: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:993:5: note: expanded from macro 'hlist_entry_safe'
              ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
              ^~~~~~~
   net/core/rtnetlink.c:5571:3: note: '?' condition is true
                   hlist_for_each_entry(dev, head, index_hlist) {
                   ^
   include/linux/list.h:1003:13: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
                      ^
   include/linux/list.h:993:5: note: expanded from macro 'hlist_entry_safe'
              ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
              ^
   net/core/rtnetlink.c:5571:3: note: Loop condition is true.  Entering loop body
                   hlist_for_each_entry(dev, head, index_hlist) {
                   ^
   include/linux/list.h:1003:2: note: expanded from macro 'hlist_for_each_entry'
           for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
           ^
   net/core/rtnetlink.c:5572:8: note: Assuming 'idx' is >= 's_idx'
                           if (idx < s_idx)
                               ^~~~~~~~~~~
   net/core/rtnetlink.c:5572:4: note: Taking false branch
                           if (idx < s_idx)
                           ^
   net/core/rtnetlink.c:5574:10: note: Calling 'rtnl_fill_statsinfo'
                           err = rtnl_fill_statsinfo(skb, dev, RTM_NEWSTATS,
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/rtnetlink.c:5159:2: note: 'err' declared without an initial value
           int err;
           ^~~~~~~
   net/core/rtnetlink.c:5161:2: note: Assuming the condition is false
           ASSERT_RTNL();
           ^
   include/linux/rtnetlink.h:110:12: note: expanded from macro 'ASSERT_RTNL'
           WARN_ONCE(!rtnl_is_locked(), \
                     ^~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:150:18: note: expanded from macro 'WARN_ONCE'
           DO_ONCE_LITE_IF(condition, WARN, 1, format)
                           ^~~~~~~~~
   include/linux/once_lite.h:15:27: note: expanded from macro 'DO_ONCE_LITE_IF'
                   bool __ret_do_once = !!(condition);                     \
                                           ^~~~~~~~~
   net/core/rtnetlink.c:5161:2: note: '__ret_do_once' is false
           ASSERT_RTNL();
           ^
   include/linux/rtnetlink.h:110:2: note: expanded from macro 'ASSERT_RTNL'
           WARN_ONCE(!rtnl_is_locked(), \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:150:2: note: expanded from macro 'WARN_ONCE'
           DO_ONCE_LITE_IF(condition, WARN, 1, format)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/once_lite.h:17:16: note: expanded from macro 'DO_ONCE_LITE_IF'
                   if (unlikely(__ret_do_once && !__already_done)) {       \
                                ^~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/core/rtnetlink.c:5161:2: note: Left side of '&&' is false
           ASSERT_RTNL();
           ^
   include/linux/rtnetlink.h:110:2: note: expanded from macro 'ASSERT_RTNL'
           WARN_ONCE(!rtnl_is_locked(), \
           ^
   include/asm-generic/bug.h:150:2: note: expanded from macro 'WARN_ONCE'
           DO_ONCE_LITE_IF(condition, WARN, 1, format)
           ^
   include/linux/once_lite.h:17:30: note: expanded from macro 'DO_ONCE_LITE_IF'
                   if (unlikely(__ret_do_once && !__already_done)) {       \

vim +5311 net/core/rtnetlink.c

a79159c08b5a56 Petr Machata        2022-02-21  5146  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5147  static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev,
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5148  			       int type, u32 pid, u32 seq, u32 change,
a79159c08b5a56 Petr Machata        2022-02-21  5149  			       unsigned int flags,
a79159c08b5a56 Petr Machata        2022-02-21  5150  			       const struct rtnl_stats_dump_filters *filters,
33f11b46a4f00f Petr Machata        2022-02-21  5151  			       int *idxattr, int *prividx,
33f11b46a4f00f Petr Machata        2022-02-21  5152  			       struct netlink_ext_ack *extack)
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5153  {
a79159c08b5a56 Petr Machata        2022-02-21  5154  	unsigned int filter_mask = filters->mask[0];
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5155  	struct if_stats_msg *ifsm;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5156  	struct nlmsghdr *nlh;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5157  	struct nlattr *attr;
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5158  	int s_prividx = *prividx;
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5159  	int err;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5160  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5161  	ASSERT_RTNL();
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5162  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5163  	nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifsm), flags);
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5164  	if (!nlh)
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5165  		return -EMSGSIZE;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5166  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5167  	ifsm = nlmsg_data(nlh);
ce024f42c2e28b Nikolay Aleksandrov 2017-10-03  5168  	ifsm->family = PF_UNSPEC;
ce024f42c2e28b Nikolay Aleksandrov 2017-10-03  5169  	ifsm->pad1 = 0;
ce024f42c2e28b Nikolay Aleksandrov 2017-10-03  5170  	ifsm->pad2 = 0;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5171  	ifsm->ifindex = dev->ifindex;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5172  	ifsm->filter_mask = filter_mask;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5173  
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5174  	if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_64, *idxattr)) {
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5175  		struct rtnl_link_stats64 *sp;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5176  
58414d32a37e4c Nicolas Dichtel     2016-04-21  5177  		attr = nla_reserve_64bit(skb, IFLA_STATS_LINK_64,
58414d32a37e4c Nicolas Dichtel     2016-04-21  5178  					 sizeof(struct rtnl_link_stats64),
58414d32a37e4c Nicolas Dichtel     2016-04-21  5179  					 IFLA_STATS_UNSPEC);
ef1f07a8a52555 Petr Machata        2022-02-21  5180  		if (!attr) {
ef1f07a8a52555 Petr Machata        2022-02-21  5181  			err = -EMSGSIZE;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5182  			goto nla_put_failure;
ef1f07a8a52555 Petr Machata        2022-02-21  5183  		}
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5184  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5185  		sp = nla_data(attr);
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5186  		dev_get_stats(dev, sp);
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5187  	}
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5188  
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5189  	if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_XSTATS, *idxattr)) {
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5190  		const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5191  
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5192  		if (ops && ops->fill_linkxstats) {
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5193  			*idxattr = IFLA_STATS_LINK_XSTATS;
ae0be8de9a53cd Michal Kubecek      2019-04-26  5194  			attr = nla_nest_start_noflag(skb,
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5195  						     IFLA_STATS_LINK_XSTATS);
ef1f07a8a52555 Petr Machata        2022-02-21  5196  			if (!attr) {
ef1f07a8a52555 Petr Machata        2022-02-21  5197  				err = -EMSGSIZE;
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5198  				goto nla_put_failure;
ef1f07a8a52555 Petr Machata        2022-02-21  5199  			}
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5200  
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5201  			err = ops->fill_linkxstats(skb, dev, prividx, *idxattr);
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5202  			nla_nest_end(skb, attr);
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5203  			if (err)
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5204  				goto nla_put_failure;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5205  			*idxattr = 0;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5206  		}
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5207  	}
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5208  
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5209  	if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_XSTATS_SLAVE,
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5210  			     *idxattr)) {
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5211  		const struct rtnl_link_ops *ops = NULL;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5212  		const struct net_device *master;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5213  
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5214  		master = netdev_master_upper_dev_get(dev);
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5215  		if (master)
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5216  			ops = master->rtnl_link_ops;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5217  		if (ops && ops->fill_linkxstats) {
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5218  			*idxattr = IFLA_STATS_LINK_XSTATS_SLAVE;
ae0be8de9a53cd Michal Kubecek      2019-04-26  5219  			attr = nla_nest_start_noflag(skb,
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5220  						     IFLA_STATS_LINK_XSTATS_SLAVE);
ef1f07a8a52555 Petr Machata        2022-02-21  5221  			if (!attr) {
ef1f07a8a52555 Petr Machata        2022-02-21  5222  				err = -EMSGSIZE;
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5223  				goto nla_put_failure;
ef1f07a8a52555 Petr Machata        2022-02-21  5224  			}
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5225  
80e73cc563c435 Nikolay Aleksandrov 2016-06-28  5226  			err = ops->fill_linkxstats(skb, dev, prividx, *idxattr);
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5227  			nla_nest_end(skb, attr);
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5228  			if (err)
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5229  				goto nla_put_failure;
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5230  			*idxattr = 0;
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5231  		}
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5232  	}
97a47facf3468f Nikolay Aleksandrov 2016-04-30  5233  
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5234  	if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_OFFLOAD_XSTATS,
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5235  			     *idxattr)) {
a79159c08b5a56 Petr Machata        2022-02-21  5236  		u32 off_filter_mask;
a79159c08b5a56 Petr Machata        2022-02-21  5237  
a79159c08b5a56 Petr Machata        2022-02-21  5238  		off_filter_mask = filters->mask[IFLA_STATS_LINK_OFFLOAD_XSTATS];
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5239  		*idxattr = IFLA_STATS_LINK_OFFLOAD_XSTATS;
ae0be8de9a53cd Michal Kubecek      2019-04-26  5240  		attr = nla_nest_start_noflag(skb,
ae0be8de9a53cd Michal Kubecek      2019-04-26  5241  					     IFLA_STATS_LINK_OFFLOAD_XSTATS);
ef1f07a8a52555 Petr Machata        2022-02-21  5242  		if (!attr) {
ef1f07a8a52555 Petr Machata        2022-02-21  5243  			err = -EMSGSIZE;
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5244  			goto nla_put_failure;
ef1f07a8a52555 Petr Machata        2022-02-21  5245  		}
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5246  
a79159c08b5a56 Petr Machata        2022-02-21  5247  		err = rtnl_offload_xstats_fill(skb, dev, prividx,
33f11b46a4f00f Petr Machata        2022-02-21  5248  					       off_filter_mask, extack);
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5249  		if (err == -ENODATA)
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5250  			nla_nest_cancel(skb, attr);
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5251  		else
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5252  			nla_nest_end(skb, attr);
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5253  
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5254  		if (err && err != -ENODATA)
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5255  			goto nla_put_failure;
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5256  		*idxattr = 0;
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5257  	}
69ae6ad2ff3791 Nogah Frankel       2016-09-16  5258  
aefb4d4ad83b60 Robert Shearman     2017-01-16  5259  	if (stats_attr_valid(filter_mask, IFLA_STATS_AF_SPEC, *idxattr)) {
aefb4d4ad83b60 Robert Shearman     2017-01-16  5260  		struct rtnl_af_ops *af_ops;
aefb4d4ad83b60 Robert Shearman     2017-01-16  5261  
aefb4d4ad83b60 Robert Shearman     2017-01-16  5262  		*idxattr = IFLA_STATS_AF_SPEC;
ae0be8de9a53cd Michal Kubecek      2019-04-26  5263  		attr = nla_nest_start_noflag(skb, IFLA_STATS_AF_SPEC);
ef1f07a8a52555 Petr Machata        2022-02-21  5264  		if (!attr) {
ef1f07a8a52555 Petr Machata        2022-02-21  5265  			err = -EMSGSIZE;
aefb4d4ad83b60 Robert Shearman     2017-01-16  5266  			goto nla_put_failure;
ef1f07a8a52555 Petr Machata        2022-02-21  5267  		}
aefb4d4ad83b60 Robert Shearman     2017-01-16  5268  
5fa85a09390c4a Florian Westphal    2017-10-16  5269  		rcu_read_lock();
5fa85a09390c4a Florian Westphal    2017-10-16  5270  		list_for_each_entry_rcu(af_ops, &rtnl_af_ops, list) {
aefb4d4ad83b60 Robert Shearman     2017-01-16  5271  			if (af_ops->fill_stats_af) {
aefb4d4ad83b60 Robert Shearman     2017-01-16  5272  				struct nlattr *af;
aefb4d4ad83b60 Robert Shearman     2017-01-16  5273  				int err;
aefb4d4ad83b60 Robert Shearman     2017-01-16  5274  
ae0be8de9a53cd Michal Kubecek      2019-04-26  5275  				af = nla_nest_start_noflag(skb,
ae0be8de9a53cd Michal Kubecek      2019-04-26  5276  							   af_ops->family);
5fa85a09390c4a Florian Westphal    2017-10-16  5277  				if (!af) {
5fa85a09390c4a Florian Westphal    2017-10-16  5278  					rcu_read_unlock();
aefb4d4ad83b60 Robert Shearman     2017-01-16  5279  					goto nla_put_failure;
5fa85a09390c4a Florian Westphal    2017-10-16  5280  				}
aefb4d4ad83b60 Robert Shearman     2017-01-16  5281  				err = af_ops->fill_stats_af(skb, dev);
aefb4d4ad83b60 Robert Shearman     2017-01-16  5282  
5fa85a09390c4a Florian Westphal    2017-10-16  5283  				if (err == -ENODATA) {
aefb4d4ad83b60 Robert Shearman     2017-01-16  5284  					nla_nest_cancel(skb, af);
5fa85a09390c4a Florian Westphal    2017-10-16  5285  				} else if (err < 0) {
5fa85a09390c4a Florian Westphal    2017-10-16  5286  					rcu_read_unlock();
aefb4d4ad83b60 Robert Shearman     2017-01-16  5287  					goto nla_put_failure;
5fa85a09390c4a Florian Westphal    2017-10-16  5288  				}
aefb4d4ad83b60 Robert Shearman     2017-01-16  5289  
aefb4d4ad83b60 Robert Shearman     2017-01-16  5290  				nla_nest_end(skb, af);
aefb4d4ad83b60 Robert Shearman     2017-01-16  5291  			}
aefb4d4ad83b60 Robert Shearman     2017-01-16  5292  		}
5fa85a09390c4a Florian Westphal    2017-10-16  5293  		rcu_read_unlock();
aefb4d4ad83b60 Robert Shearman     2017-01-16  5294  
aefb4d4ad83b60 Robert Shearman     2017-01-16  5295  		nla_nest_end(skb, attr);
aefb4d4ad83b60 Robert Shearman     2017-01-16  5296  
aefb4d4ad83b60 Robert Shearman     2017-01-16  5297  		*idxattr = 0;
aefb4d4ad83b60 Robert Shearman     2017-01-16  5298  	}
aefb4d4ad83b60 Robert Shearman     2017-01-16  5299  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5300  	nlmsg_end(skb, nlh);
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5301  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5302  	return 0;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5303  
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5304  nla_put_failure:
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5305  	/* not a multi message or no progress mean a real error */
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5306  	if (!(flags & NLM_F_MULTI) || s_prividx == *prividx)
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5307  		nlmsg_cancel(skb, nlh);
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5308  	else
e8872a25a05efc Nikolay Aleksandrov 2016-04-30  5309  		nlmsg_end(skb, nlh);
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5310  
ef1f07a8a52555 Petr Machata        2022-02-21 @5311  	return err;
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5312  }
10c9ead9f3c6bb Roopa Prabhu        2016-04-20  5313  

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-25 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-25 13:49 [jpirko-mlxsw:gearboxes 5/72] net/core/rtnetlink.c:5311:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.