Re: [PATCH libcrypto v2 2/3] compiler: introduce at_least parameter decoration pseudo keyword

From: Herbert Xu

Date: Fri Nov 21 2025 - 21:45:45 EST


Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>
> +/*
> + * This designates the minimum number of elements a passed array parameter must
> + * have. For example:
> + *
> + * void some_function(u8 param[at_least 7]);
> + *
> + * If a caller passes an array with fewer than 7 elements, the compiler will
> + * emit a warning.
> + */
> +#define at_least static

Please make this conditional on __CHECKER__ as sparse still chokes
on the following which compiles fine with gcc and clang:

int foo(int n, int a[static n])
{
return a[0]++;
}

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt