[netfilter-nf-next:testing 6/11] net/netfilter/nf_nat_proto.c:721:25: warning: unused variable 'skb'

From: kernel test robot
Date: Fri May 27 2022 - 03:04:24 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git testing
head: 1baa240a3c6507449f4a3cd150dddacf69d95fb5
commit: 93d6b481397f4c62da1568b463a4d4b254578c37 [6/11] netfilter: make hook functions accept only one argument
config: i386-randconfig-a014-20211029 (https://download.01.org/0day-ci/archive/20220527/202205271540.880v8PNJ-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git/commit/?id=93d6b481397f4c62da1568b463a4d4b254578c37
git remote add netfilter-nf-next git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git
git fetch --no-tags netfilter-nf-next testing
git checkout 93d6b481397f4c62da1568b463a4d4b254578c37
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/netfilter/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

net/netfilter/nf_nat_proto.c: In function 'nf_nat_ipv4_out':
>> net/netfilter/nf_nat_proto.c:721:25: warning: unused variable 'skb' [-Wunused-variable]
721 | struct sk_buff *skb = state->skb;
| ^~~
net/netfilter/nf_nat_proto.c: In function 'nf_nat_ipv6_out':
net/netfilter/nf_nat_proto.c:960:25: warning: unused variable 'skb' [-Wunused-variable]
960 | struct sk_buff *skb = state->skb;
| ^~~


vim +/skb +721 net/netfilter/nf_nat_proto.c

717
718 static unsigned int
719 nf_nat_ipv4_out(const struct nf_hook_state *state)
720 {
> 721 struct sk_buff *skb = state->skb;
722 #ifdef CONFIG_XFRM
723 const struct nf_conn *ct;
724 enum ip_conntrack_info ctinfo;
725 int err;
726 #endif
727 unsigned int ret;
728
729 ret = nf_nat_ipv4_fn(state);
730 #ifdef CONFIG_XFRM
731 if (ret != NF_ACCEPT)
732 return ret;
733
734 if (IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED)
735 return ret;
736
737 ct = nf_ct_get(skb, &ctinfo);
738 if (ct) {
739 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
740
741 if (ct->tuplehash[dir].tuple.src.u3.ip !=
742 ct->tuplehash[!dir].tuple.dst.u3.ip ||
743 (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
744 ct->tuplehash[dir].tuple.src.u.all !=
745 ct->tuplehash[!dir].tuple.dst.u.all)) {
746 err = nf_xfrm_me_harder(state->net, skb, AF_INET);
747 if (err < 0)
748 ret = NF_DROP_ERR(err);
749 }
750 }
751 #endif
752 return ret;
753 }
754

--
0-DAY CI Kernel Test Service
https://01.org/lkp