From: kernel test robot <lkp@intel.com>
To: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
Florian Westphal <fw@strlen.de>
Subject: [netfilter-nf:testing 11/20] net/netfilter/ipset/ip_set_hash_gen.h:379:21: warning: result of comparison of constant -1 with expression of type 'u8' (aka 'unsigned char') is always false
Date: Wed, 08 Jul 2026 12:59:36 +0200 [thread overview]
Message-ID: <202607081250.ODagxDyb-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git testing
head: c2fbcb9151957c3d921a7441cf080e49eb13b05d
commit: a900abcb974bae821a5d4ae79ad3442808915416 [11/20] netfilter: ipset: rework cidr bookkeeping
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260708/202607081250.ODagxDyb-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260708/202607081250.ODagxDyb-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607081250.ODagxDyb-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from net/netfilter/ipset/ip_set_hash_ipportnet.c:131:
>> net/netfilter/ipset/ip_set_hash_gen.h:379:21: warning: result of comparison of constant -1 with expression of type 'u8' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
379 | if (unlikely(found == -1))
| ~~~~~ ^ ~~
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
In file included from net/netfilter/ipset/ip_set_hash_ipportnet.c:391:
>> net/netfilter/ipset/ip_set_hash_gen.h:379:21: warning: result of comparison of constant -1 with expression of type 'u8' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
379 | if (unlikely(found == -1))
| ~~~~~ ^ ~~
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
2 warnings generated.
vim +379 net/netfilter/ipset/ip_set_hash_gen.h
364
365 static void
366 mtype_del_cidr(struct ip_set *set, struct htype *h, u8 cidr, u8 n)
367 {
368 struct net_prefixes *nets, *tmp;
369 u8 i, j, found, len = 0;
370
371 spin_lock_bh(&set->lock);
372 nets = __ipset_dereference(h->rnets[n]);
373 for (i = 0, found = -1; i < nets->len; i++) {
374 if (nets->nets[i].count)
375 len++;
376 if (nets->nets[i].cidr == cidr)
377 found = i;
378 }
> 379 if (unlikely(found == -1))
380 return;
381 nets->nets[found].count--;
382 if (nets->nets[found].count)
383 goto unlock;
384 len--;
385 tmp = kzalloc(sizeof(struct net_prefixes) +
386 len * sizeof(struct net_prefix), GFP_ATOMIC);
387 if (!tmp)
388 /* Leave a hole */
389 return;
390 tmp->len = len;
391 for (i = 0, j = 0; i < nets->len; i++) {
392 if (!nets->nets[i].count || i == found)
393 continue;
394 tmp->nets[j].cidr = nets->nets[i].cidr;
395 tmp->nets[j++].count = nets->nets[i].count;
396 }
397 rcu_assign_pointer(h->rnets[n], tmp);
398 kfree_rcu(nets, rcu);
399 unlock:
400 spin_unlock_bh(&set->lock);
401 }
402 #endif
403
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-07-08 11:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 10:59 kernel test robot [this message]
2026-07-09 10:15 ` [netfilter-nf:testing 11/20] net/netfilter/ipset/ip_set_hash_gen.h:379:21: warning: result of comparison of constant -1 with expression of type 'u8' (aka 'unsigned char') is always false Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202607081250.ODagxDyb-lkp@intel.com \
--to=lkp@intel.com \
--cc=coreteam@netfilter.org \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=llvm@lists.linux.dev \
--cc=netfilter-devel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.