[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj9+OtEku8u9vfEUzMe5LMN-j5VjkDoo-KyKrcjN0oxrA@mail.gmail.com>
Date: Wed, 19 Nov 2025 08:22:51 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: kernel test robot <lkp@...el.com>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, Eric Biggers <ebiggers@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>, Kees Cook <kees@...nel.org>, linux-crypto@...r.kernel.org,
llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH libcrypto 2/2] crypto: chacha20poly1305: statically check
fixed array lengths
On Wed, 19 Nov 2025 at 04:46, kernel test robot <lkp@...el.com> wrote:
>
> >> drivers/net/wireguard/cookie.c:193:2: warning: array argument is too small; contains 31 elements, callee requires at least 32 [-Warray-bounds]
Hmm. Is this a compiler bug?
That checker->cookie_encryption_key is declared as
u8 cookie_encryption_key[NOISE_SYMMETRIC_KEY_LEN];
and NOISE_SYMMETRIC_KEY_LEN is an enum that is defined to be the same
as CHACHA20POLY1305_KEY_SIZE, which is 32.
And the compiler is aware of that:
> include/crypto/chacha20poly1305.h:32:20: note: callee declares array parameter as static here
> 32 | const u8 key[min_array_size(CHACHA20POLY1305_KEY_SIZE)]);
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
but still talks about "contains 31 elements".
Is this some confusion with the compiler thinking that a "const u8[]"
is a string, and then at some point subtracted one as the max length,
and then is confused due to that?
Because if compilers screw this up, we can't do that 'static' thing,
regardless of name. I'm not willing to play silly buggers with broken
compiler warnings.
Linus
Powered by blists - more mailing lists