linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@kernel.org>
Subject: Re: [linux-next:master 5136/13299] include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'}
Date: Wed, 18 Oct 2023 13:38:00 +0200	[thread overview]
Message-ID: <CANn89iKdMVNrV_0QienhpCJ98D7hj2sqOOYFhhSHBVHzvtkgWQ@mail.gmail.com> (raw)
In-Reply-To: <202310181854.pKtHd7fD-lkp@intel.com>

On Wed, Oct 18, 2023 at 1:01 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Eric,
>
> FYI, the error/warning still remains.
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   2dac75696c6da3c848daa118a729827541c89d33
> commit: fa17a6d8a5bd0cd7565b613cb804242cd0f6b7ab [5136/13299] ipv6: lockless IPV6_ADDR_PREFERENCES implementation
> config: alpha-defconfig (https://download.01.org/0day-ci/archive/20231018/202310181854.pKtHd7fD-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181854.pKtHd7fD-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/202310181854.pKtHd7fD-lkp@intel.com/
>

I have no idea why this compiler is not happy.

I would probably contact a compiler maintainer perhaps ?


> All warnings (new ones prefixed by >>):
>
>    In file included from arch/alpha/include/asm/rwonce.h:33,
>                     from include/linux/compiler.h:246,
>                     from include/linux/string.h:5,
>                     from net/sunrpc/xprtsock.c:23:
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_finish_connecting' at net/sunrpc/xprtsock.c:2325:4,
>        inlined from 'xs_tcp_setup_socket' at net/sunrpc/xprtsock.c:2405:11:
> >> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
>          |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/rwonce.h:55:40: note: in definition of macro '__WRITE_ONCE'
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |                                        ^~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
>       50 |         __READ_ONCE(x);                                                 \
>          |         ^~~~~~~~~~~
>    include/net/ipv6.h:1366:21: note: in expansion of macro 'READ_ONCE'
>     1366 |                    (READ_ONCE(inet6_sk(sk)->srcprefs) & prefmask) | pref);
>          |                     ^~~~~~~~~
>    In function 'xs_tcp_setup_socket':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_finish_connecting' at net/sunrpc/xprtsock.c:2325:4,
>        inlined from 'xs_tcp_setup_socket' at net/sunrpc/xprtsock.c:2405:11:
>    include/asm-generic/rwonce.h:55:37: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
>    include/asm-generic/rwonce.h:61:9: note: in expansion of macro '__WRITE_ONCE'
>       61 |         __WRITE_ONCE(x, val);                                           \
>          |         ^~~~~~~~~~~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    In function 'xs_tcp_setup_socket':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_tls_finish_connecting' at net/sunrpc/xprtsock.c:2478:4:
> >> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
>          |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/rwonce.h:55:40: note: in definition of macro '__WRITE_ONCE'
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |                                        ^~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
>       50 |         __READ_ONCE(x);                                                 \
>          |         ^~~~~~~~~~~
>    include/net/ipv6.h:1366:21: note: in expansion of macro 'READ_ONCE'
>     1366 |                    (READ_ONCE(inet6_sk(sk)->srcprefs) & prefmask) | pref);
>          |                     ^~~~~~~~~
>    In function 'xs_tcp_tls_finish_connecting':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_tls_finish_connecting' at net/sunrpc/xprtsock.c:2478:4:
>    include/asm-generic/rwonce.h:55:37: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
>    include/asm-generic/rwonce.h:61:9: note: in expansion of macro '__WRITE_ONCE'
>       61 |         __WRITE_ONCE(x, val);                                           \
>          |         ^~~~~~~~~~~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    In function 'xs_tcp_tls_finish_connecting':
>    cc1: note: source object is likely at address zero
>
>
> 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@kernel.org>
> :::::: CC: Will Deacon <will@kernel.org>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


      reply	other threads:[~2023-10-18 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 10:59 kernel test robot
2023-10-18 11:38 ` Eric Dumazet [this message]

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=CANn89iKdMVNrV_0QienhpCJ98D7hj2sqOOYFhhSHBVHzvtkgWQ@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=dsahern@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox