All of lore.kernel.org
 help / color / mirror / Atom feed
* [norov:bitmap_param 26/26] lib/find_bit.c:309 find_random_bit() warn: always true condition '(w <= (~0)) => (0-u32max <= u32max)'
@ 2026-07-23 17:20 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-23 17:20 UTC (permalink / raw)
  To: Yury Norov; +Cc: oe-kbuild-all

tree:   https://github.com/norov/linux bitmap_param
head:   7973e783d2679c9ea1219c4beca33564fea1b38d
commit: 7973e783d2679c9ea1219c4beca33564fea1b38d [26/26] bitmap: return unsigned long from weight operations
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260724/202607240007.bsuUdB89-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

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/202607240007.bsuUdB89-lkp@intel.com/

smatch warnings:
lib/find_bit.c:309 find_random_bit() warn: always true condition '(w <= (~0)) => (0-u32max <= u32max)'

vim +309 lib/find_bit.c

   288	
   289	/**
   290	 * find_random_bit - find a set bit at random position
   291	 * @addr: The address to base the search on
   292	 * @size: The bitmap size in bits
   293	 *
   294	 * Returns: a position of a random set bit; >= @size otherwise
   295	 */
   296	unsigned long find_random_bit(const unsigned long *addr, unsigned long size)
   297	{
   298		unsigned long w = bitmap_weight(addr, size);
   299	
   300		switch (w) {
   301		case 0:
   302			return size;
   303		case 1:
   304			/* Performance trick for single-bit bitmaps */
   305			return find_first_bit(addr, size);
   306		default: {
   307			unsigned long n, random;
   308	
 > 309			if (w <= U32_MAX) {

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

only message in thread, other threads:[~2026-07-23 17:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 17:20 [norov:bitmap_param 26/26] lib/find_bit.c:309 find_random_bit() warn: always true condition '(w <= (~0)) => (0-u32max <= u32max)' kernel test robot

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.