All of lore.kernel.org
 help / color / mirror / Atom feed
* [norov:unload-bitmap 6/8] include/linux/bitmap.h:613:25: warning: array subscript 0 is outside array bounds of 'const long unsigned int[0]'
@ 2023-10-18 12:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-10-18 12:54 UTC (permalink / raw)
  To: Yury Norov; +Cc: oe-kbuild-all

tree:   https://github.com/norov/linux unload-bitmap
head:   d12b2cd2f2cace0c68638a2c474e4d0a32b533e5
commit: fe8066a1c1d802a28b2a805e80e908daea9a6ffe [6/8] lib/bitmap: add bitmap_{read,write}()
config: i386-randconfig-002-20231018 (https://download.01.org/0day-ci/archive/20231018/202310182030.NH54Diui-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310182030.NH54Diui-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310182030.NH54Diui-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from lib/test_bitmap.c:8:
   In function 'bitmap_write',
       inlined from 'test_bitmap_read_write' at lib/test_bitmap.c:1312:2:
   include/linux/bitmap.h:666:12: warning: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Warray-bounds]
     666 |         map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits);
         |         ~~~^~~~~~~~~~~
   include/linux/bitmap.h:666:24: warning: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Warray-bounds]
     666 |         map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits);
         |                        ^~
   include/linux/bitmap.h:667:12: warning: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Warray-bounds]
     667 |         map[index + 1] |= (value >> space);
         |         ~~~^~~~~~~~~~~
   In function 'bitmap_read',
       inlined from 'test_bitmap_read_write' at lib/test_bitmap.c:1314:2:
>> include/linux/bitmap.h:613:25: warning: array subscript 0 is outside array bounds of 'const long unsigned int[0]' [-Warray-bounds]
     613 |         value_high = map[index + 1] & BITMAP_LAST_WORD_MASK(start + nbits);
         |                      ~~~^~~~~~~~~~~


vim +613 include/linux/bitmap.h

   589	
   590	/**
   591	 * bitmap_read - read a value of n-bits from the memory region
   592	 * @map: address to the bitmap memory region
   593	 * @start: bit offset of the n-bit value
   594	 * @nbits: size of value in bits, nonzero, up to BITS_PER_LONG
   595	 *
   596	 * Returns: value of nbits located at the @start bit offset within the @map
   597	 * memory region.
   598	 */
   599	static inline unsigned long bitmap_read(const unsigned long *map,
   600						unsigned long start,
   601						unsigned long nbits)
   602	{
   603		size_t index = BIT_WORD(start);
   604		unsigned long offset = start % BITS_PER_LONG;
   605		unsigned long space = BITS_PER_LONG - offset;
   606		unsigned long value_low, value_high;
   607	
   608		if (unlikely(!nbits))
   609			return 0;
   610		if (space >= nbits)
   611			return (map[index] >> offset) & GENMASK(nbits - 1, 0);
   612		value_low = map[index] & BITMAP_FIRST_WORD_MASK(start);
 > 613		value_high = map[index + 1] & BITMAP_LAST_WORD_MASK(start + nbits);
   614		return (value_low >> offset) | (value_high << space);
   615	}
   616	

-- 
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:[~2023-10-18 12:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 12:54 [norov:unload-bitmap 6/8] include/linux/bitmap.h:613:25: warning: array subscript 0 is outside array bounds of 'const long unsigned int[0]' 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.