arch/alpha/include/asm/rwonce.h:25:35: warning: array subscript 0 is outside array bounds of 'struct inode[11885788707287082]'

From: kernel test robot
Date: Tue Sep 19 2023 - 06:43:11 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2cf0f715623872823a72e451243bbf555d10d032
commit: 0af950f57fefabab628f1963af881e6b9bfe7f38 ovl: move ovl_entry into ovl_inode
date: 3 months ago
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230919/202309191848.cMwd2D4d-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309191848.cMwd2D4d-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309191848.cMwd2D4d-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/compiler.h:246,
from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from fs/overlayfs/util.c:7:
In function 'ovl_upperdentry_dereference',
inlined from 'ovl_dentry_upper' at fs/overlayfs/util.c:266:9,
inlined from 'ovl_path_type' at fs/overlayfs/util.c:184:6:
>> arch/alpha/include/asm/rwonce.h:25:35: warning: array subscript 0 is outside array bounds of 'struct inode[11885788707287082]' [-Warray-bounds=]
25 | __unqual_scalar_typeof(x) __x = \
| ^~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
fs/overlayfs/ovl_entry.h:163:16: note: in expansion of macro 'READ_ONCE'
163 | return READ_ONCE(oi->__upperdentry);
| ^~~~~~~~~


vim +25 arch/alpha/include/asm/rwonce.h

d6462858851549 Will Deacon 2019-10-30 11
d6462858851549 Will Deacon 2019-10-30 12 /*
d6462858851549 Will Deacon 2019-10-30 13 * Alpha is apparently daft enough to reorder address-dependent loads
d6462858851549 Will Deacon 2019-10-30 14 * on some CPU implementations. Knock some common sense into it with
d6462858851549 Will Deacon 2019-10-30 15 * a memory barrier in READ_ONCE().
d6462858851549 Will Deacon 2019-10-30 16 *
d6462858851549 Will Deacon 2019-10-30 17 * For the curious, more information about this unusual reordering is
d6462858851549 Will Deacon 2019-10-30 18 * available in chapter 15 of the "perfbook":
d6462858851549 Will Deacon 2019-10-30 19 *
d6462858851549 Will Deacon 2019-10-30 20 * https://kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html
d6462858851549 Will Deacon 2019-10-30 21 *
d6462858851549 Will Deacon 2019-10-30 22 */
d6462858851549 Will Deacon 2019-10-30 23 #define __READ_ONCE(x) \
d6462858851549 Will Deacon 2019-10-30 24 ({ \
d6462858851549 Will Deacon 2019-10-30 @25 __unqual_scalar_typeof(x) __x = \
d6462858851549 Will Deacon 2019-10-30 26 (*(volatile typeof(__x) *)(&(x))); \
d6462858851549 Will Deacon 2019-10-30 27 mb(); \
d6462858851549 Will Deacon 2019-10-30 28 (typeof(x))__x; \
d6462858851549 Will Deacon 2019-10-30 29 })
d6462858851549 Will Deacon 2019-10-30 30

:::::: The code at line 25 was first introduced by commit
:::::: d6462858851549c62d73eaa14b31132b0f32d6b6 alpha: Override READ_ONCE() with barriered implementation

:::::: TO: Will Deacon <will@xxxxxxxxxx>
:::::: CC: Will Deacon <will@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki