[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSEh684nt05JOYor@gondor.apana.org.au>
Date: Sat, 22 Nov 2025 10:37:31 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: ebiggers@...nel.org, Jason@...c4.com, ardb@...nel.org, kees@...nel.org,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH libcrypto 1/2] array_size: introduce min_array_size()
function decoration
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
>
> I wouldn't call that "asked for".
>
> It was more a musing on how random that "static" syntax is and it's
> likely incomprehensible to a lot of people - but also pointing out
> that we already do have users of it, and saying that maybe it won't be
> incomprehensible once we have a lot of users.
>
> So I'm definitely not pushing for it.
>
> But I do suspect it makes people understand what the code does more...
Actually there is one reason for using a macro instead of static
directly, sparse still seems to choke on a non-static value for
static:
int foo(int n, int a[static n])
{
return a[0]++;
}
This compiles correctly with gcc and clang, but sparse chokes on it:
a.c:1:29: error: undefined identifier 'n'
a.c:1:29: error: bad constant expression type
I was trying to use it in crypto/ecc.c where the arrays are
defined as ECC_MAX_DIGITS, but only the first ndigits are valid.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists