From: Herbert Xu <herbert@gondor.apana.org.au>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: ebiggers@kernel.org, Jason@zx2c4.com, ardb@kernel.org,
kees@kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH libcrypto 1/2] array_size: introduce min_array_size() function decoration
Date: Sat, 22 Nov 2025 10:37:31 +0800 [thread overview]
Message-ID: <aSEh684nt05JOYor@gondor.apana.org.au> (raw)
In-Reply-To: <CAHk-=wgkKPgsmcC0SFni7hhQM_b3qNjoyzw_JL2ZVs2eWXEZWQ@mail.gmail.com>
Linus Torvalds <torvalds@linux-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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2025-11-22 2:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 17:02 Jason A. Donenfeld
2025-11-18 17:02 ` [PATCH libcrypto 2/2] crypto: chacha20poly1305: statically check fixed array lengths Jason A. Donenfeld
2025-11-19 10:36 ` kernel test robot
2025-11-19 12:45 ` kernel test robot
2025-11-19 16:22 ` Linus Torvalds
2025-11-19 16:46 ` Jason A. Donenfeld
2025-11-19 16:57 ` Linus Torvalds
2025-11-19 18:45 ` Nathan Chancellor
2025-11-18 23:24 ` [PATCH libcrypto 1/2] array_size: introduce min_array_size() function decoration Eric Biggers
2025-11-18 23:31 ` Jason A. Donenfeld
2025-11-19 19:04 ` Jason A. Donenfeld
2025-11-19 19:10 ` Ard Biesheuvel
2025-11-19 23:02 ` david laight
2025-11-18 23:32 ` Linus Torvalds
2025-11-22 2:37 ` Herbert Xu [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=aSEh684nt05JOYor@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=ebiggers@kernel.org \
--cc=kees@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®