:::::: :::::: Manual check reason: "low confidence bisect report" :::::: Manual check reason: "low confidence static check warning: lib/find_bit.c:90:40: warning: use of uninitialized value 'tmp' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]" ::::::
BCC: [email protected] CC: [email protected] TO: Yury Norov <[email protected]> tree: https://github.com/norov/linux fns head: 585dc3f17d3cbd1636e7ff44b3908bf9c1f41797 commit: d720f1934c9d2d5fedb2f71791903bcaf6efc6ff [8/11] lib: add find_nth(,and,andnot)_bit() :::::: branch date: 2 days ago :::::: commit date: 2 days ago config: arm-randconfig-c002-20220917 (https://download.01.org/0day-ci/archive/20220918/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/norov/linux/commit/d720f1934c9d2d5fedb2f71791903bcaf6efc6ff git remote add norov https://github.com/norov/linux git fetch --no-tags norov fns git checkout d720f1934c9d2d5fedb2f71791903bcaf6efc6ff # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <[email protected]> gcc_analyzer warnings: (new ones prefixed by >>) In file included from lib/find_bit.c:19: lib/find_bit.c: In function '__find_nth_bit': >> lib/find_bit.c:90:40: warning: use of uninitialized value 'tmp' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~~~~~~~~~~~ include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' 31 | typeof(x) unique_x = (x); \ | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' 45 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~ lib/find_bit.c:140:16: note: in expansion of macro 'FIND_NTH_BIT' 140 | return FIND_NTH_BIT(addr[idx], size, n); | ^~~~~~~~~~~~ '__find_nth_bit': event 1 | | 73 | unsigned long sz = (size), __n = (n), idx, w, tmp; \ | | ^~~ | | | | | (1) region created on stack here lib/find_bit.c:140:16: note: in expansion of macro 'FIND_NTH_BIT' | 140 | return FIND_NTH_BIT(addr[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_bit': event 2 | | 75 | for (idx = 0; (idx + 1) * BITS_PER_LONG <= sz; idx++) { \ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ | | | | | (2) following 'false' branch... lib/find_bit.c:140:16: note: in expansion of macro 'FIND_NTH_BIT' | 140 | return FIND_NTH_BIT(addr[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_bit': event 3 | | 89 | found: \ | | ^~~~~ | | | | | (3) ...to here lib/find_bit.c:140:16: note: in expansion of macro 'FIND_NTH_BIT' | 140 | return FIND_NTH_BIT(addr[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_bit': event 4 | | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~~~~~~~~~~~ | | | | | (4) use of uninitialized value 'tmp' here include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' | 31 | typeof(x) unique_x = (x); \ | | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' | 45 | #define min(x, y) __careful_cmp(x, y, <) | | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~ lib/find_bit.c:140:16: note: in expansion of macro 'FIND_NTH_BIT' | 140 | return FIND_NTH_BIT(addr[idx], size, n); | | ^~~~~~~~~~~~ | lib/find_bit.c: In function '__find_nth_and_bit': >> lib/find_bit.c:90:40: warning: use of uninitialized value 'tmp' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~~~~~~~~~~~ include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' 31 | typeof(x) unique_x = (x); \ | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' 45 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~ lib/find_bit.c:147:16: note: in expansion of macro 'FIND_NTH_BIT' 147 | return FIND_NTH_BIT(addr1[idx] & addr2[idx], size, n); | ^~~~~~~~~~~~ '__find_nth_and_bit': event 1 | | 73 | unsigned long sz = (size), __n = (n), idx, w, tmp; \ | | ^~~ | | | | | (1) region created on stack here lib/find_bit.c:147:16: note: in expansion of macro 'FIND_NTH_BIT' | 147 | return FIND_NTH_BIT(addr1[idx] & addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_and_bit': event 2 | | 75 | for (idx = 0; (idx + 1) * BITS_PER_LONG <= sz; idx++) { \ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ | | | | | (2) following 'false' branch... lib/find_bit.c:147:16: note: in expansion of macro 'FIND_NTH_BIT' | 147 | return FIND_NTH_BIT(addr1[idx] & addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_and_bit': event 3 | | 89 | found: \ | | ^~~~~ | | | | | (3) ...to here lib/find_bit.c:147:16: note: in expansion of macro 'FIND_NTH_BIT' | 147 | return FIND_NTH_BIT(addr1[idx] & addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_and_bit': event 4 | | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~~~~~~~~~~~ | | | | | (4) use of uninitialized value 'tmp' here include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' | 31 | typeof(x) unique_x = (x); \ | | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' | 45 | #define min(x, y) __careful_cmp(x, y, <) | | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~ lib/find_bit.c:147:16: note: in expansion of macro 'FIND_NTH_BIT' | 147 | return FIND_NTH_BIT(addr1[idx] & addr2[idx], size, n); | | ^~~~~~~~~~~~ | lib/find_bit.c: In function '__find_nth_andnot_bit': >> lib/find_bit.c:90:40: warning: use of uninitialized value 'tmp' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~~~~~~~~~~~ include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' 31 | typeof(x) unique_x = (x); \ | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' 45 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | ^~~ lib/find_bit.c:154:16: note: in expansion of macro 'FIND_NTH_BIT' 154 | return FIND_NTH_BIT(addr1[idx] & ~addr2[idx], size, n); | ^~~~~~~~~~~~ '__find_nth_andnot_bit': event 1 | | 73 | unsigned long sz = (size), __n = (n), idx, w, tmp; \ | | ^~~ | | | | | (1) region created on stack here lib/find_bit.c:154:16: note: in expansion of macro 'FIND_NTH_BIT' | 154 | return FIND_NTH_BIT(addr1[idx] & ~addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_andnot_bit': event 2 | | 75 | for (idx = 0; (idx + 1) * BITS_PER_LONG <= sz; idx++) { \ | | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ | | | | | (2) following 'false' branch... lib/find_bit.c:154:16: note: in expansion of macro 'FIND_NTH_BIT' | 154 | return FIND_NTH_BIT(addr1[idx] & ~addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_andnot_bit': event 3 | | 89 | found: \ | | ^~~~~ | | | | | (3) ...to here lib/find_bit.c:154:16: note: in expansion of macro 'FIND_NTH_BIT' | 154 | return FIND_NTH_BIT(addr1[idx] & ~addr2[idx], size, n); | | ^~~~~~~~~~~~ | '__find_nth_andnot_bit': event 4 | | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~~~~~~~~~~~ | | | | | (4) use of uninitialized value 'tmp' here include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once' | 31 | typeof(x) unique_x = (x); \ | | ^ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' | 45 | #define min(x, y) __careful_cmp(x, y, <) | | ^~~~~~~~~~~~~ lib/find_bit.c:90:14: note: in expansion of macro 'min' | 90 | sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ | | ^~~ lib/find_bit.c:154:16: note: in expansion of macro 'FIND_NTH_BIT' | 154 | return FIND_NTH_BIT(addr1[idx] & ~addr2[idx], size, n); | | ^~~~~~~~~~~~ | vim +/tmp +90 lib/find_bit.c 0ade34c37012ea Clement Courbet 2018-02-06 70 d720f1934c9d2d Yury Norov 2022-07-10 71 #define FIND_NTH_BIT(FETCH, size, n) \ d720f1934c9d2d Yury Norov 2022-07-10 72 ({ \ d720f1934c9d2d Yury Norov 2022-07-10 73 unsigned long sz = (size), __n = (n), idx, w, tmp; \ d720f1934c9d2d Yury Norov 2022-07-10 74 \ d720f1934c9d2d Yury Norov 2022-07-10 75 for (idx = 0; (idx + 1) * BITS_PER_LONG <= sz; idx++) { \ d720f1934c9d2d Yury Norov 2022-07-10 76 if (idx * BITS_PER_LONG + __n >= sz) \ d720f1934c9d2d Yury Norov 2022-07-10 77 goto out; \ d720f1934c9d2d Yury Norov 2022-07-10 78 \ d720f1934c9d2d Yury Norov 2022-07-10 79 tmp = (FETCH); \ d720f1934c9d2d Yury Norov 2022-07-10 80 w = hweight_long(tmp); \ d720f1934c9d2d Yury Norov 2022-07-10 81 if (w > __n) \ d720f1934c9d2d Yury Norov 2022-07-10 82 goto found; \ d720f1934c9d2d Yury Norov 2022-07-10 83 \ d720f1934c9d2d Yury Norov 2022-07-10 84 __n -= w; \ d720f1934c9d2d Yury Norov 2022-07-10 85 } \ d720f1934c9d2d Yury Norov 2022-07-10 86 \ d720f1934c9d2d Yury Norov 2022-07-10 87 if (sz % BITS_PER_LONG) \ d720f1934c9d2d Yury Norov 2022-07-10 88 tmp = (FETCH) & BITMAP_LAST_WORD_MASK(sz); \ d720f1934c9d2d Yury Norov 2022-07-10 89 found: \ d720f1934c9d2d Yury Norov 2022-07-10 @90 sz = min(idx * BITS_PER_LONG + fns(tmp, __n), sz); \ d720f1934c9d2d Yury Norov 2022-07-10 91 out: \ d720f1934c9d2d Yury Norov 2022-07-10 92 sz; \ d720f1934c9d2d Yury Norov 2022-07-10 93 }) d720f1934c9d2d Yury Norov 2022-07-10 94 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
