All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 11987/12912] net/netfilter/nf_conntrack_core.c:2117:6-13: WARNING: Unsigned expression compared with zero: protoff < 0 (fwd)
@ 2020-05-27 13:40 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2020-05-27 13:40 UTC (permalink / raw)
  To: kbuild-all

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

Protoff is unsigned, so it can't be negative on line 2117.

julia

---------- Forwarded message ----------
Date: Wed, 27 May 2020 08:01:10 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [linux-next:master 11987/12912]
    net/netfilter/nf_conntrack_core.c:2117:6-13: WARNING: Unsigned expression
    compared with zero: protoff < 0

CC: kbuild-all(a)lists.01.org
TO: Pablo Neira Ayuso <pablo@netfilter.org>
CC: Florian Westphal <fw@strlen.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b0523c7b1c9d0edcd6c0fe6d2cb558a9ad5c60a8
commit: ee04805ff54a63ffd90bc6749ebfe73473734ddb [11987/12912] netfilter: conntrack: make conntrack userspace helpers work again
:::::: branch date: 13 hours ago
:::::: commit date: 29 hours ago
config: microblaze-randconfig-c022-20200526 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> net/netfilter/nf_conntrack_core.c:2117:6-13: WARNING: Unsigned expression compared with zero: protoff < 0

# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ee04805ff54a63ffd90bc6749ebfe73473734ddb
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update linux-next
git checkout ee04805ff54a63ffd90bc6749ebfe73473734ddb
vim +2117 net/netfilter/nf_conntrack_core.c

368982cd7d1bd41 Pablo Neira Ayuso 2018-05-23  2086
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2087  /* This packet is coming from userspace via nf_queue, complete the packet
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2088   * processing after the helper invocation in nf_confirm().
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2089   */
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2090  static int nf_confirm_cthelper(struct sk_buff *skb, struct nf_conn *ct,
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2091  			       enum ip_conntrack_info ctinfo)
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2092  {
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2093  	const struct nf_conntrack_helper *helper;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2094  	const struct nf_conn_help *help;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2095  	unsigned int protoff;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2096
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2097  	help = nfct_help(ct);
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2098  	if (!help)
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2099  		return 0;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2100
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2101  	helper = rcu_dereference(help->helper);
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2102  	if (!(helper->flags & NF_CT_HELPER_F_USERSPACE))
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2103  		return 0;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2104
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2105  	switch (nf_ct_l3num(ct)) {
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2106  	case NFPROTO_IPV4:
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2107  		protoff = skb_network_offset(skb) + ip_hdrlen(skb);
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2108  		break;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2109  #if IS_ENABLED(CONFIG_IPV6)
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2110  	case NFPROTO_IPV6: {
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2111  		__be16 frag_off;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2112  		u8 pnum;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2113
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2114  		pnum = ipv6_hdr(skb)->nexthdr;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2115  		protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum,
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2116  					   &frag_off);
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24 @2117  		if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2118  			return 0;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2119  		break;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2120  	}
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2121  #endif
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2122  	default:
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2123  		return 0;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2124  	}
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2125
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2126  	if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2127  	    !nf_is_loopback_packet(skb)) {
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2128  		if (!nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) {
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2129  			NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2130  			return -1;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2131  		}
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2132  	}
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2133
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2134  	/* We've seen it coming out the other side: confirm it */
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2135  	return nf_conntrack_confirm(skb) == NF_DROP ? - 1 : 0;
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2136  }
ee04805ff54a63f Pablo Neira Ayuso 2020-05-24  2137

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32876 bytes --]

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

only message in thread, other threads:[~2020-05-27 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:40 [linux-next:master 11987/12912] net/netfilter/nf_conntrack_core.c:2117:6-13: WARNING: Unsigned expression compared with zero: protoff < 0 (fwd) Julia Lawall

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.