[gustavoars:testing/fsfa3 17/17] include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]'

From: kernel test robot
Date: Fri Mar 24 2023 - 19:05:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/fsfa3
head: 2226ddb6a576f7f89a8a06a3f89b68f5109ded53
commit: 2226ddb6a576f7f89a8a06a3f89b68f5109ded53 [17/17] Makefile: Enable -Wstringop-overflow and -Warray-bounds
config: s390-defconfig (https://download.01.org/0day-ci/archive/20230325/202303250644.7mtCknON-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 12.1.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/gustavoars/linux.git/commit/?id=2226ddb6a576f7f89a8a06a3f89b68f5109ded53
git remote add gustavoars https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars testing/fsfa3
git checkout 2226ddb6a576f7f89a8a06a3f89b68f5109ded53
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash arch/s390/kernel/ fs/autofs/ fs/cifs/ kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303250644.7mtCknON-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/exit.c:1915:32: warning: no previous prototype for 'abort' [-Wmissing-prototypes]
1915 | __weak __function_aligned void abort(void)
| ^~~~~
In file included from arch/s390/include/asm/rwonce.h:29,
from include/linux/compiler.h:247,
from arch/s390/include/asm/bug.h:5,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:6,
from kernel/exit.c:8:
In function 'preempt_count',
inlined from 'make_task_dead' at kernel/exit.c:938:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'make_task_dead' at kernel/exit.c:938:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'make_task_dead' at kernel/exit.c:938:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'make_task_dead' at kernel/exit.c:948:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'make_task_dead' at kernel/exit.c:949:3:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count_set',
inlined from 'make_task_dead' at kernel/exit.c:952:3:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:25:23: note: in expansion of macro 'READ_ONCE'
25 | old = READ_ONCE(S390_lowcore.preempt_count);
| ^~~~~~~~~
In file included from arch/s390/include/asm/bitops.h:39,
from include/linux/bitops.h:68,
from include/linux/thread_info.h:27,
from arch/s390/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7:
In function '__atomic_cmpxchg',
inlined from 'preempt_count_set' at arch/s390/include/asm/preempt.h:28:11,
inlined from 'make_task_dead' at kernel/exit.c:952:3:
arch/s390/include/asm/atomic_ops.h:159:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
159 | asm volatile(
| ^~~
arch/s390/include/asm/atomic_ops.h:159:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
--
In file included from arch/s390/include/asm/rwonce.h:29,
from include/linux/compiler.h:247,
from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/smp.h:12,
from include/linux/kernel_stat.h:5,
from kernel/softirq.c:13:
In function 'preempt_count',
inlined from 'tasklet_kill' at kernel/softirq.c:878:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'tasklet_kill' at kernel/softirq.c:878:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'tasklet_kill' at kernel/softirq.c:878:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '_local_bh_enable' at kernel/softirq.c:368:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable' at kernel/softirq.c:353:6,
inlined from '_local_bh_enable' at kernel/softirq.c:369:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable' at kernel/softirq.c:356:6,
inlined from '_local_bh_enable' at kernel/softirq.c:369:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In file included from arch/s390/include/asm/bitops.h:39,
from include/linux/bitops.h:68,
from include/linux/kernel.h:22,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13:
In function '__atomic_add',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:59:2,
inlined from '__preempt_count_sub' at arch/s390/include/asm/preempt.h:64:2,
inlined from '__local_bh_enable' at kernel/softirq.c:359:2,
inlined from '_local_bh_enable' at kernel/softirq.c:369:2:
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
In function '__atomic_add',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:59:2,
inlined from '__local_bh_disable_ip' at include/linux/bottom_half.h:13:2,
inlined from 'softirq_handle_begin' at kernel/softirq.c:409:2,
inlined from '__do_softirq' at kernel/softirq.c:547:2:
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
In function 'preempt_count',
inlined from '__do_softirq' at kernel/softirq.c:566:16:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__do_softirq' at kernel/softirq.c:573:7:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__do_softirq' at kernel/softirq.c:574:4:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count_set',
inlined from '__do_softirq' at kernel/softirq.c:577:4:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:25:23: note: in expansion of macro 'READ_ONCE'
25 | old = READ_ONCE(S390_lowcore.preempt_count);
| ^~~~~~~~~
In function '__atomic_cmpxchg',
inlined from 'preempt_count_set' at arch/s390/include/asm/preempt.h:28:11,
inlined from '__do_softirq' at kernel/softirq.c:577:4:
arch/s390/include/asm/atomic_ops.h:159:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
159 | asm volatile(
| ^~~
arch/s390/include/asm/atomic_ops.h:159:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
In function 'preempt_count',
inlined from '__local_bh_enable' at kernel/softirq.c:353:6,
inlined from 'softirq_handle_end' at kernel/softirq.c:414:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable' at kernel/softirq.c:356:6,
inlined from 'softirq_handle_end' at kernel/softirq.c:414:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function '__atomic_add',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:59:2,
inlined from '__preempt_count_sub' at arch/s390/include/asm/preempt.h:64:2,
inlined from '__local_bh_enable' at kernel/softirq.c:359:2,
inlined from 'softirq_handle_end' at kernel/softirq.c:414:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
In function 'preempt_count',
inlined from 'softirq_handle_end' at kernel/softirq.c:415:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'softirq_handle_end' at kernel/softirq.c:415:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'softirq_handle_end' at kernel/softirq.c:415:2,
inlined from '__do_softirq' at kernel/softirq.c:600:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'do_softirq' at kernel/softirq.c:464:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'do_softirq' at kernel/softirq.c:464:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from 'do_softirq' at kernel/softirq.c:464:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable_ip' at kernel/softirq.c:375:2:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable_ip' at kernel/softirq.c:383:6:
>> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function '__atomic_add',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:59:2,
inlined from '__preempt_count_sub' at arch/s390/include/asm/preempt.h:64:2,
inlined from '__local_bh_enable_ip' at kernel/softirq.c:389:2:
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable_ip' at kernel/softirq.c:391:6:
include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable_ip' at kernel/softirq.c:391:6:
include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function 'preempt_count',
inlined from '__local_bh_enable_ip' at kernel/softirq.c:391:6:
include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of 'const volatile int[0]' [-Warray-bounds]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
arch/s390/include/asm/preempt.h:17:16: note: in expansion of macro 'READ_ONCE'
17 | return READ_ONCE(S390_lowcore.preempt_count) & ~PREEMPT_NEED_RESCHED;
| ^~~~~~~~~
In function '__atomic_add_const',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:55:4,
inlined from '__preempt_count_sub' at arch/s390/include/asm/preempt.h:64:2,
inlined from '__local_bh_enable_ip' at kernel/softirq.c:399:2:
arch/s390/include/asm/atomic_ops.h:80:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
80 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:87:9: note: in expansion of macro '__ATOMIC_CONST_OP'
87 | __ATOMIC_CONST_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:90:1: note: in expansion of macro '__ATOMIC_CONST_OPS'
90 | __ATOMIC_CONST_OPS(__atomic_add_const, int, "asi")
| ^~~~~~~~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:80:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
80 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:87:9: note: in expansion of macro '__ATOMIC_CONST_OP'
87 | __ATOMIC_CONST_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:90:1: note: in expansion of macro '__ATOMIC_CONST_OPS'
90 | __ATOMIC_CONST_OPS(__atomic_add_const, int, "asi")
| ^~~~~~~~~~~~~~~~~~
In function '__atomic_add',
inlined from '__preempt_count_add' at arch/s390/include/asm/preempt.h:59:2,
inlined from 'irq_enter_rcu' at kernel/softirq.c:609:2:
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
arch/s390/include/asm/atomic_ops.h:61:9: note: in expansion of macro '__ATOMIC_OP'
61 | __ATOMIC_OP(op_name, op_type, op_string, "\n") \
| ^~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:64:1: note: in expansion of macro '__ATOMIC_OPS'
64 | __ATOMIC_OPS(__atomic_add, int, "laa")
| ^~~~~~~~~~~~
arch/s390/include/asm/atomic_ops.h:52:9: warning: array subscript 0 is outside array bounds of 'int[0]' [-Warray-bounds]
52 | asm volatile( \
| ^~~
..


vim +44 include/asm-generic/rwonce.h

e506ea451254ab Will Deacon 2019-10-15 28
e506ea451254ab Will Deacon 2019-10-15 29 /*
e506ea451254ab Will Deacon 2019-10-15 30 * Yes, this permits 64-bit accesses on 32-bit architectures. These will
e506ea451254ab Will Deacon 2019-10-15 31 * actually be atomic in some cases (namely Armv7 + LPAE), but for others we
e506ea451254ab Will Deacon 2019-10-15 32 * rely on the access being split into 2x32-bit accesses for a 32-bit quantity
e506ea451254ab Will Deacon 2019-10-15 33 * (e.g. a virtual address) and a strong prevailing wind.
e506ea451254ab Will Deacon 2019-10-15 34 */
e506ea451254ab Will Deacon 2019-10-15 35 #define compiletime_assert_rwonce_type(t) \
e506ea451254ab Will Deacon 2019-10-15 36 compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
e506ea451254ab Will Deacon 2019-10-15 37 "Unsupported access size for {READ,WRITE}_ONCE().")
e506ea451254ab Will Deacon 2019-10-15 38
e506ea451254ab Will Deacon 2019-10-15 39 /*
e506ea451254ab Will Deacon 2019-10-15 40 * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
3c9184109e78ea Will Deacon 2019-10-30 41 * atomicity. Note that this may result in tears!
e506ea451254ab Will Deacon 2019-10-15 42 */
b78b331a3f5c07 Will Deacon 2019-10-15 43 #ifndef __READ_ONCE
e506ea451254ab Will Deacon 2019-10-15 @44 #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
b78b331a3f5c07 Will Deacon 2019-10-15 45 #endif
e506ea451254ab Will Deacon 2019-10-15 46

:::::: The code at line 44 was first introduced by commit
:::::: e506ea451254ab17e0bf918ca36232fec2a9b10c compiler.h: Split {READ,WRITE}_ONCE definitions out into rwonce.h

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

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