[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
kernel test robot <[email protected]>
| Newsgroups | gmane.comp.security.firewalls.netfilter.devel |
|---|---|
| Message-ID | <[email protected]> |
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/[email protected]/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/[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 >>): 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