All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 11305/11331] include/linux/find.h:119:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'int[1]'
@ 2021-08-30 13:44 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-30 13:44 UTC (permalink / raw
  To: Stephen Rothwell; +Cc: kbuild-all, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 14731 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   93717cde744f9d26aa1b4561f7d9ba2a230459eb
commit: 9a73242564ee491f17c929ea7b82f5ce208fcd00 [11305/11331] Merge branch 'akpm-current/current'
config: ia64-buildonly-randconfig-r004-20210830 (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=9a73242564ee491f17c929ea7b82f5ce208fcd00
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 9a73242564ee491f17c929ea7b82f5ce208fcd00
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/pgtable.h:153,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/debugfs.h:15,
                    from drivers/iommu/intel/iommu.c:18:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |         unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                                ^~~~~~~
   In file included from include/linux/bitmap.h:9,
                    from drivers/iommu/intel/iommu.c:17:
   drivers/iommu/intel/iommu.c: In function 'domain_context_mapping_one':
>> include/linux/find.h:119:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'int[1]' [-Warray-bounds]
     119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
         |                                     ^~~~~
   drivers/iommu/intel/iommu.c:1992:18: note: while referencing 'max_pde'
    1992 |         int pds, max_pde;
         |                  ^~~~~~~
--
   In file included from arch/ia64/include/asm/pgtable.h:153,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/debugfs.h:15,
                    from drivers/bus/mhi/core/init.c:7:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |         unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                                ^~~~~~~
   In file included from include/linux/bitmap.h:9,
                    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/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/bus/mhi/core/init.c:7:
   drivers/bus/mhi/core/init.c: In function 'to_mhi_pm_state_str':
>> include/linux/find.h:187:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'enum mhi_pm_state[1]' [-Warray-bounds]
     187 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
         |                                     ^~~~~
   drivers/bus/mhi/core/init.c:80:51: note: while referencing 'state'
      80 | const char *to_mhi_pm_state_str(enum mhi_pm_state state)
         |                                 ~~~~~~~~~~~~~~~~~~^~~~~


vim +119 include/linux/find.h

c7f612cdf091de include/asm-generic/bitops/find.h Akinobu Mita   2006-03-26  105  
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  106  #ifndef find_first_bit
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  107  /**
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  108   * find_first_bit - find the first set bit in a memory region
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  109   * @addr: The address to start the search at
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  110   * @size: The maximum number of bits to search
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  111   *
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  112   * Returns the bit number of the first set bit.
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  113   * If no bits are set, returns @size.
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  114   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  115  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  116  unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  117  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  118  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06 @119  		unsigned long val = *addr & GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  120  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  121  		return val ? __ffs(val) : size;
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  122  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  123  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  124  	return _find_first_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  125  }
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  126  #endif
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  127  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  128  #ifndef find_first_and_bit
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  129  /**
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  130   * find_first_and_bit - find the first set bit in both memory regions
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  131   * @addr1: The first address to base the search on
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  132   * @addr2: The second address to base the search on
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  133   * @size: The bitmap size in bits
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  134   *
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  135   * Returns the bit number for the next set bit
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  136   * If no bits are set, returns @size.
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  137   */
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  138  static inline
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  139  unsigned long find_first_and_bit(const unsigned long *addr1,
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  140  				 const unsigned long *addr2,
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  141  				 unsigned long size)
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  142  {
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  143  	if (small_const_nbits(size)) {
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  144  		unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0);
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  145  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  146  		return val ? __ffs(val) : size;
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  147  	}
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  148  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  149  	return _find_first_and_bit(addr1, addr2, size);
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  150  }
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  151  #endif
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  152  
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  153  #ifndef find_first_zero_bit
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  154  /**
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  155   * find_first_zero_bit - find the first cleared bit in a memory region
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  156   * @addr: The address to start the search at
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  157   * @size: The maximum number of bits to search
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  158   *
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  159   * Returns the bit number of the first cleared bit.
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  160   * If no bits are zero, returns @size.
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  161   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  162  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  163  unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  164  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  165  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  166  		unsigned long val = *addr | ~GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  167  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  168  		return val == ~0UL ? size : ffz(val);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  169  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  170  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  171  	return _find_first_zero_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  172  }
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  173  #endif
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  174  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  175  #ifndef find_last_bit
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  176  /**
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  177   * find_last_bit - find the last set bit in a memory region
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  178   * @addr: The address to start the search at
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  179   * @size: The number of bits to search
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  180   *
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  181   * Returns the bit number of the last set bit, or size.
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  182   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  183  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  184  unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  185  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  186  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06 @187  		unsigned long val = *addr & GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  188  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  189  		return val ? __fls(val) : size;
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  190  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  191  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  192  	return _find_last_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  193  }
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  194  #endif
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  195  

:::::: The code at line 119 was first introduced by commit
:::::: 2cc7b6a44ac21d31b398b03f4845c53152070416 lib: add fast path for find_first_*_bit() and find_last_bit()

:::::: TO: Yury Norov <yury.norov@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32882 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [linux-next:master 11305/11331] include/linux/find.h:119:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'int[1]'
@ 2021-08-30 13:44 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-30 13:44 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 14915 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   93717cde744f9d26aa1b4561f7d9ba2a230459eb
commit: 9a73242564ee491f17c929ea7b82f5ce208fcd00 [11305/11331] Merge branch 'akpm-current/current'
config: ia64-buildonly-randconfig-r004-20210830 (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=9a73242564ee491f17c929ea7b82f5ce208fcd00
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 9a73242564ee491f17c929ea7b82f5ce208fcd00
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/pgtable.h:153,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/debugfs.h:15,
                    from drivers/iommu/intel/iommu.c:18:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |         unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                                ^~~~~~~
   In file included from include/linux/bitmap.h:9,
                    from drivers/iommu/intel/iommu.c:17:
   drivers/iommu/intel/iommu.c: In function 'domain_context_mapping_one':
>> include/linux/find.h:119:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'int[1]' [-Warray-bounds]
     119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
         |                                     ^~~~~
   drivers/iommu/intel/iommu.c:1992:18: note: while referencing 'max_pde'
    1992 |         int pds, max_pde;
         |                  ^~~~~~~
--
   In file included from arch/ia64/include/asm/pgtable.h:153,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/debugfs.h:15,
                    from drivers/bus/mhi/core/init.c:7:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |         unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                                ^~~~~~~
   In file included from include/linux/bitmap.h:9,
                    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/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/bus/mhi/core/init.c:7:
   drivers/bus/mhi/core/init.c: In function 'to_mhi_pm_state_str':
>> include/linux/find.h:187:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'enum mhi_pm_state[1]' [-Warray-bounds]
     187 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
         |                                     ^~~~~
   drivers/bus/mhi/core/init.c:80:51: note: while referencing 'state'
      80 | const char *to_mhi_pm_state_str(enum mhi_pm_state state)
         |                                 ~~~~~~~~~~~~~~~~~~^~~~~


vim +119 include/linux/find.h

c7f612cdf091de include/asm-generic/bitops/find.h Akinobu Mita   2006-03-26  105  
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  106  #ifndef find_first_bit
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  107  /**
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  108   * find_first_bit - find the first set bit in a memory region
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  109   * @addr: The address to start the search at
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  110   * @size: The maximum number of bits to search
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  111   *
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  112   * Returns the bit number of the first set bit.
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  113   * If no bits are set, returns @size.
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  114   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  115  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  116  unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  117  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  118  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06 @119  		unsigned long val = *addr & GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  120  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  121  		return val ? __ffs(val) : size;
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  122  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  123  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  124  	return _find_first_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  125  }
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  126  #endif
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  127  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  128  #ifndef find_first_and_bit
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  129  /**
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  130   * find_first_and_bit - find the first set bit in both memory regions
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  131   * @addr1: The first address to base the search on
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  132   * @addr2: The second address to base the search on
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  133   * @size: The bitmap size in bits
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  134   *
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  135   * Returns the bit number for the next set bit
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  136   * If no bits are set, returns @size.
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  137   */
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  138  static inline
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  139  unsigned long find_first_and_bit(const unsigned long *addr1,
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  140  				 const unsigned long *addr2,
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  141  				 unsigned long size)
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  142  {
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  143  	if (small_const_nbits(size)) {
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  144  		unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0);
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  145  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  146  		return val ? __ffs(val) : size;
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  147  	}
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  148  
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  149  	return _find_first_and_bit(addr1, addr2, size);
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  150  }
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  151  #endif
6b6c111934a424 include/linux/find.h              Yury Norov     2021-08-24  152  
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  153  #ifndef find_first_zero_bit
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  154  /**
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  155   * find_first_zero_bit - find the first cleared bit in a memory region
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  156   * @addr: The address to start the search at
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  157   * @size: The maximum number of bits to search
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  158   *
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  159   * Returns the bit number of the first cleared bit.
ec778edf97dcaa include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12  160   * If no bits are zero, returns @size.
708ff2a0097b02 include/asm-generic/bitops/find.h Akinobu Mita   2010-09-29  161   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  162  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  163  unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  164  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  165  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  166  		unsigned long val = *addr | ~GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  167  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  168  		return val == ~0UL ? size : ffz(val);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  169  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  170  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  171  	return _find_first_zero_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  172  }
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  173  #endif
e296d831fe2e5a include/asm-generic/bitops/find.h Yury Norov     2021-08-24  174  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  175  #ifndef find_last_bit
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  176  /**
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  177   * find_last_bit - find the last set bit in a memory region
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  178   * @addr: The address to start the search at
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  179   * @size: The number of bits to search
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  180   *
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  181   * Returns the bit number of the last set bit, or size.
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  182   */
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  183  static inline
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  184  unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  185  {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  186  	if (small_const_nbits(size)) {
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06 @187  		unsigned long val = *addr & GENMASK(size - 1, 0);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  188  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  189  		return val ? __fls(val) : size;
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  190  	}
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  191  
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  192  	return _find_last_bit(addr, size);
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  193  }
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  194  #endif
2cc7b6a44ac21d include/asm-generic/bitops/find.h Yury Norov     2021-05-06  195  

:::::: The code at line 119 was first introduced by commit
:::::: 2cc7b6a44ac21d31b398b03f4845c53152070416 lib: add fast path for find_first_*_bit() and find_last_bit()

:::::: TO: Yury Norov <yury.norov@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32882 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-30 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-30 13:44 [linux-next:master 11305/11331] include/linux/find.h:119:37: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'int[1]' kernel test robot
2021-08-30 13:44 ` 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.