All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [alobakin:pfcp /15] include/linux/bitmap.h:614:12: warning: array subscript [2, 288230376151711743] is outside array bounds of 'long unsigned int[1]'
Date: Tue, 19 Sep 2023 22:05:41 +0800	[thread overview]
Message-ID: <202309192102.IbPhVSJj-lkp@intel.com> (raw)

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

                 reply	other threads:[~2023-09-19 14:06 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=202309192102.IbPhVSJj-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.