All of lore.kernel.org
 help / color / mirror / Atom feed
* [alobakin:pfcp /15] include/linux/bitmap.h:614:12: warning: array subscript [2, 288230376151711743] is outside array bounds of 'long unsigned int[1]'
@ 2023-09-19 14:05 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-09-19 14:05 UTC (permalink / raw)
  To: Alexander Lobakin; +Cc: oe-kbuild-all

tree:   https://github.com/alobakin/linux pfcp
head:   b963c50bbf48f78bf5dd0750b9e11a2b64536356
commit: 305dd2e2a8739070f378d87ee0c2871e42d80d3c [/15] bitmap: extend bitmap_{get,set}_value8() to bitmap_{get,set}_bits()
config: arm64-randconfig-003-20230919 (https://download.01.org/0day-ci/archive/20230919/202309192102.IbPhVSJj-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309192102.IbPhVSJj-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/202309192102.IbPhVSJj-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/cpumask.h:12,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/irq.h:14,
                    from include/linux/irqchip/chained_irq.h:10,
                    from include/linux/gpio/driver.h:6,
                    from drivers/pinctrl/pinctrl-keembay.c:6:
   In function 'bitmap_set_bits',
       inlined from 'keembay_gpio_set_irq' at drivers/pinctrl/pinctrl-keembay.c:1348:2,
       inlined from 'keembay_gpio_irq_enable' at drivers/pinctrl/pinctrl-keembay.c:1380:2:
>> include/linux/bitmap.h:614:12: warning: array subscript [2, 288230376151711743] is outside array bounds of 'long unsigned int[1]' [-Warray-bounds=]
     614 |         map[index] &= ~(mask << offset);
         |         ~~~^~~~~~~
   drivers/pinctrl/pinctrl-keembay.c: In function 'keembay_gpio_irq_enable':
   drivers/pinctrl/pinctrl-keembay.c:1344:30: note: at offset [16, 2305843009213693944] into object 'reg' of size 8
    1344 |         unsigned long flags, reg;
         |                              ^~~
   In function 'bitmap_set_bits',
       inlined from 'keembay_gpio_set_irq' at drivers/pinctrl/pinctrl-keembay.c:1348:2,
       inlined from 'keembay_gpio_irq_enable' at drivers/pinctrl/pinctrl-keembay.c:1380:2:
   include/linux/bitmap.h:615:20: warning: array subscript [2, 288230376151711743] is outside array bounds of 'long unsigned int[1]' [-Warray-bounds=]
     615 |         map[index] |= (value & mask) << offset;
         |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-keembay.c: In function 'keembay_gpio_irq_enable':
   drivers/pinctrl/pinctrl-keembay.c:1344:30: note: at offset [16, 2305843009213693944] into object 'reg' of size 8
    1344 |         unsigned long flags, reg;
         |                              ^~~


vim +614 include/linux/bitmap.h

   592	
   593	/**
   594	 * bitmap_set_bits - set a @len-bit value within a memory region
   595	 * @map: address to the bitmap memory region
   596	 * @start: bit offset of the value
   597	 * @len: bit width of the value
   598	 * @value: new value to set
   599	 *
   600	 * Replaces the @len-bit value located at the @start bit offset within the @src
   601	 * memory region with the new @value. The value can't cross ``BITS_PER_LONG``
   602	 * boundary.
   603	 */
   604	static inline void bitmap_set_bits(unsigned long *map, unsigned long start,
   605					   size_t len, unsigned long value)
   606	{
   607		const size_t index = BIT_WORD(start);
   608		const unsigned long offset = start % BITS_PER_LONG;
   609		unsigned long mask = GENMASK(len - 1, 0);
   610	
   611		if (WARN_ON_ONCE(offset + len > BITS_PER_LONG))
   612			return;
   613	
 > 614		map[index] &= ~(mask << offset);
   615		map[index] |= (value & mask) << offset;
   616	}
   617	

-- 
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-09-19 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 14:05 [alobakin:pfcp /15] include/linux/bitmap.h:614:12: warning: array subscript [2, 288230376151711743] is outside array bounds of 'long unsigned int[1]' 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.