From: kernel test robot <lkp@intel.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [norov:bitmap_param 26/26] lib/find_bit.c:309 find_random_bit() warn: always true condition '(w <= (~0)) => (0-u32max <= u32max)'
Date: Fri, 24 Jul 2026 01:20:39 +0800 [thread overview]
Message-ID: <202607240007.bsuUdB89-lkp@intel.com> (raw)
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
reply other threads:[~2026-07-23 17:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202607240007.bsuUdB89-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=yury.norov@gmail.com \
/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.