net/netfilter/ipvs/ip_vs_core.c:932:22: warning: unused variable 'coff'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/intel-lab-lkp/linux/commits/Julian-Anastasov/ipvs-fix-the-checksum-validations/20260721-042018
head:   1e5ec3e13b0a650732b689a4514d2f6eace5f06e
commit: 1e5ec3e13b0a650732b689a4514d2f6eace5f06e ipvs: fix places with wrong packet offsets
date:   8 hours ago
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260721/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260721/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   net/netfilter/ipvs/ip_vs_core.c: In function 'ip_vs_nat_icmp':
>> net/netfilter/ipvs/ip_vs_core.c:932:22: warning: unused variable 'coff' [-Wunused-variable]
     932 |         unsigned int coff = toff + sizeof(struct icmphdr);
         |                      ^~~~
   net/netfilter/ipvs/ip_vs_core.c: In function 'ip_vs_in_icmp':
   net/netfilter/ipvs/ip_vs_core.c:1764:15: warning: variable 'outer_proto' set but not used [-Wunused-but-set-variable]
    1764 |         char *outer_proto = "IPIP";
         |               ^~~~~~~~~~~


vim +/coff +932 net/netfilter/ipvs/ip_vs_core.c

   921	
   922	/*
   923	 * Packet has been made sufficiently writable in caller
   924	 * - inout: 1=in->out, 0=out->in
   925	 */
   926	void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
   927			    struct ip_vs_conn *cp, int inout, unsigned int toff)
   928	{
   929		struct iphdr *iph	 = ip_hdr(skb);
   930		struct icmphdr *icmph	 = (struct icmphdr *)(skb->data + toff);
   931		struct iphdr *ciph	 = (struct iphdr *)(icmph + 1);
 > 932		unsigned int coff = toff + sizeof(struct icmphdr);
   933	
   934		if (inout) {
   935			iph->saddr = cp->vaddr.ip;
   936			ip_send_check(iph);
   937			ciph->daddr = cp->vaddr.ip;
   938			ip_send_check(ciph);
   939		} else {
   940			iph->daddr = cp->daddr.ip;
   941			ip_send_check(iph);
   942			ciph->saddr = cp->daddr.ip;
   943			ip_send_check(ciph);
   944		}
   945	
   946		/* the TCP/UDP/SCTP port */
   947		if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol ||
   948		    IPPROTO_SCTP == ciph->protocol) {
   949			__be16 *ports = (void *)ciph + ciph->ihl*4;
   950	
   951			if (inout)
   952				ports[1] = cp->vport;
   953			else
   954				ports[0] = cp->dport;
   955		}
   956	
   957		/* And finally the ICMP checksum */
   958		icmph->checksum = 0;
   959		icmph->checksum = ip_vs_checksum_complete(skb, toff);
   960		skb->ip_summed = CHECKSUM_UNNECESSARY;
   961	
   962		if (inout)
   963			IP_VS_DBG_PKT(11, AF_INET, pp, skb, coff,
   964				      "Forwarding altered outgoing ICMP");
   965		else
   966			IP_VS_DBG_PKT(11, AF_INET, pp, skb, coff,
   967				      "Forwarding altered incoming ICMP");
   968	}
   969	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.