[nf-next:testing 4/5] net/netfilter/nf_nat_masquerade.c:273:6: warning: variable 'ret' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git testing
head:   eb5a3496084f9a3ea3fb4c4d22b4c661d46a2743
commit: ecc701a3bd9890f83ea89337c64d4f14aba9f091 [4/5] netfilter: nf_nat: use skb_drop_reason
config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20240922/202409221130.jIDto0hf-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 8663a75fa2f31299ab8d1d90288d9df92aadee88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240922/202409221130.jIDto0hf-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409221130.jIDto0hf-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from net/netfilter/nf_nat_masquerade.c:5:
   In file included from include/linux/inetdevice.h:9:
   In file included from include/linux/ip.h:16:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/arm/include/asm/cacheflush.h:10:
   In file included from include/linux/mm.h:2232:
   include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     517 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> net/netfilter/nf_nat_masquerade.c:273:6: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
     273 |         if (ret == NF_DROP)
         |             ^~~
   net/netfilter/nf_nat_masquerade.c:253:9: note: initialize the variable 'ret' to silence this warning
     253 |         int ret;
         |                ^
         |                 = 0
   2 warnings generated.


vim +/ret +273 net/netfilter/nf_nat_masquerade.c

   243	
   244	unsigned int
   245	nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
   246			       const struct net_device *out)
   247	{
   248		enum ip_conntrack_info ctinfo;
   249		struct nf_conn_nat *nat;
   250		struct in6_addr src;
   251		struct nf_conn *ct;
   252		struct nf_nat_range2 newrange;
   253		int ret;
   254	
   255		ct = nf_ct_get(skb, &ctinfo);
   256		WARN_ON(!(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
   257				 ctinfo == IP_CT_RELATED_REPLY)));
   258	
   259		if (nat_ipv6_dev_get_saddr(nf_ct_net(ct), out,
   260					   &ipv6_hdr(skb)->daddr, 0, &src) < 0)
   261			return NF_DROP_REASON(skb, SKB_DROP_REASON_NETFILTER_DROP, EADDRNOTAVAIL);
   262	
   263		nat = nf_ct_nat_ext_add(ct);
   264		if (nat)
   265			nat->masq_index = out->ifindex;
   266	
   267		newrange.flags		= range->flags | NF_NAT_RANGE_MAP_IPS;
   268		newrange.min_addr.in6	= src;
   269		newrange.max_addr.in6	= src;
   270		newrange.min_proto	= range->min_proto;
   271		newrange.max_proto	= range->max_proto;
   272	
 > 273		if (ret == NF_DROP)
   274			return NF_DROP_REASON(skb, SKB_DROP_REASON_NETFILTER_DROP, EPERM);
   275	
   276		return ret;
   277	}
   278	EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6);
   279	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux