Skip to contentSkip to conversation

net/ipv6/ip6_output.c:154 ip6_finish_output_gso_slowpath_drop() error: uninitialized symbol 'ret'.

PATCH New Dan Carpenter 1 participant 1 message Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 14/98 net/ipv6/ip6_output.c:154 ip6_finish_output_gso_slowpath_drop() error: uninitialized symbol 'ret'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git net-next
head:   5d0f806c7608fe61c73b31b28411ebb94b962ebf
commit: d1521c0603f22c6702c63c9354e80cd94d6c7dc6 [14/98] net: ipv6: Validate GSO SKB before finish IPv6 processing
config: x86_64-randconfig-m001-20201229 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate

New smatch warnings:
net/ipv6/ip6_output.c:154 ip6_finish_output_gso_slowpath_drop() error: uninitialized symbol 'ret'.

Old smatch warnings:
net/ipv6/ip6_output.c:158 ip6_finish_output_gso_slowpath_drop() error: uninitialized symbol 'ret'. net/ipv6/ip6_output.c:291 ip6_xmit() error: we previously assumed 'np' could be null (see line 285)

vim +/ret +154 net/ipv6/ip6_output.c

d1521c0603f22c6 Aya Levin      2020-12-16  128  static int
d1521c0603f22c6 Aya Levin      2020-12-16  129  ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk,
d1521c0603f22c6 Aya Levin      2020-12-16  130  				    struct sk_buff *skb, unsigned int mtu)
d1521c0603f22c6 Aya Levin      2020-12-16  131  {
d1521c0603f22c6 Aya Levin      2020-12-16  132  	struct sk_buff *segs, *nskb;
d1521c0603f22c6 Aya Levin      2020-12-16  133  	netdev_features_t features;
d1521c0603f22c6 Aya Levin      2020-12-16  134  	int ret;
                                                        ^^^^^^^
d1521c0603f22c6 Aya Levin      2020-12-16  135  
d1521c0603f22c6 Aya Levin      2020-12-16  136  	/* Please see corresponding comment in ip_finish_output_gso
d1521c0603f22c6 Aya Levin      2020-12-16  137  	 * describing the cases where GSO segment length exceeds the
d1521c0603f22c6 Aya Levin      2020-12-16  138  	 * egress MTU.
d1521c0603f22c6 Aya Levin      2020-12-16  139  	 */
d1521c0603f22c6 Aya Levin      2020-12-16  140  	features = netif_skb_features(skb);
d1521c0603f22c6 Aya Levin      2020-12-16  141  	segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
d1521c0603f22c6 Aya Levin      2020-12-16  142  	if (IS_ERR_OR_NULL(segs)) {
d1521c0603f22c6 Aya Levin      2020-12-16  143  		kfree_skb(skb);
d1521c0603f22c6 Aya Levin      2020-12-16  144  		return -ENOMEM;
d1521c0603f22c6 Aya Levin      2020-12-16  145  	}
d1521c0603f22c6 Aya Levin      2020-12-16  146  
d1521c0603f22c6 Aya Levin      2020-12-16  147  	consume_skb(skb);
d1521c0603f22c6 Aya Levin      2020-12-16  148  
d1521c0603f22c6 Aya Levin      2020-12-16  149  	skb_list_walk_safe(segs, segs, nskb) {
d1521c0603f22c6 Aya Levin      2020-12-16  150  		int err;
d1521c0603f22c6 Aya Levin      2020-12-16  151  
d1521c0603f22c6 Aya Levin      2020-12-16  152  		skb_mark_not_on_list(segs);
d1521c0603f22c6 Aya Levin      2020-12-16  153  		err = ip6_fragment(net, sk, segs, ip6_finish_output2);
d1521c0603f22c6 Aya Levin      2020-12-16 @154  		if (err && ret == 0)
                                                                           ^^^^^^^^

"ret" is uninitialized for the first error.

d1521c0603f22c6 Aya Levin      2020-12-16  155  			ret = err;
d1521c0603f22c6 Aya Levin      2020-12-16  156  	}
d1521c0603f22c6 Aya Levin      2020-12-16  157  
d1521c0603f22c6 Aya Levin      2020-12-16  158  	return ret;
d1521c0603f22c6 Aya Levin      2020-12-16  159  }

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