[alobakin:bitops 7/8] include/linux/bitmap.h:447:22: warning: 'possible_idx[0]' is used uninitialized
From: kernel test robot
Date: Wed Jun 22 2022 - 03:25:49 EST
tree: https://github.com/alobakin/linux bitops
head: 53dc46e3f72d9b77c9c4ec23a3261d452b3bd67a
commit: 37c8723a2d98c5edce8fb5e9c2e7b8e2d9b4291c [7/8] bitmap: don't assume compiler evaluates small mem*() builtins calls
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220622/202206221502.VUxmhVnV-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/alobakin/linux/commit/37c8723a2d98c5edce8fb5e9c2e7b8e2d9b4291c
git remote add alobakin https://github.com/alobakin/linux
git fetch --no-tags alobakin bitops
git checkout 37c8723a2d98c5edce8fb5e9c2e7b8e2d9b4291c
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/ethernet/intel/ice/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from include/linux/cpumask.h:12,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:22,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/net/ethernet/intel/ice/ice.h:10,
from drivers/net/ethernet/intel/ice/ice_lib.h:7,
from drivers/net/ethernet/intel/ice/ice_switch.c:4:
drivers/net/ethernet/intel/ice/ice_switch.c: In function 'ice_find_free_recp_res_idx.constprop':
>> include/linux/bitmap.h:447:22: warning: 'possible_idx[0]' is used uninitialized [-Wuninitialized]
447 | *map |= GENMASK(start + nbits - 1, start);
| ^~
In file included from drivers/net/ethernet/intel/ice/ice.h:7,
from drivers/net/ethernet/intel/ice/ice_lib.h:7,
from drivers/net/ethernet/intel/ice/ice_switch.c:4:
drivers/net/ethernet/intel/ice/ice_switch.c:4929:24: note: 'possible_idx[0]' was declared here
4929 | DECLARE_BITMAP(possible_idx, ICE_MAX_FV_WORDS);
| ^~~~~~~~~~~~
include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP'
11 | unsigned long name[BITS_TO_LONGS(bits)]
| ^~~~
vim +447 include/linux/bitmap.h
440
441 static __always_inline void bitmap_set(unsigned long *map, unsigned int start,
442 unsigned int nbits)
443 {
444 if (__builtin_constant_p(nbits) && nbits == 1)
445 __set_bit(start, map);
446 else if (small_const_nbits(start + nbits))
> 447 *map |= GENMASK(start + nbits - 1, start);
448 else if (__builtin_constant_p(start & BITMAP_MEM_MASK) &&
449 IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) &&
450 __builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
451 IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
452 memset((char *)map + start / 8, 0xff, nbits / 8);
453 else
454 __bitmap_set(map, start, nbits);
455 }
456
--
0-DAY CI Kernel Test Service
https://01.org/lkp