[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aR1JvnpTBomcKAMZ@gondor.apana.org.au>
Date: Wed, 19 Nov 2025 12:38:22 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
Stephan Mueller <smueller@...onox.de>
Subject: [v2 PATCH] crypto: drbg - Delete unused ctx from struct sdesc
On Mon, Nov 10, 2025 at 07:44:56PM +0900, Gustavo A. R. Silva wrote:
>
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index 511a27c91813..e9f9775c237f 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1442,9 +1442,12 @@ static void drbg_kcapi_set_entropy(struct crypto_rng *tfm,
>
> #if defined(CONFIG_CRYPTO_DRBG_HASH) || defined(CONFIG_CRYPTO_DRBG_HMAC)
> struct sdesc {
> - struct shash_desc shash;
> - char ctx[];
> + /* Must be last as it ends in a flexible-array member. */
> + TRAILING_OVERLAP(struct shash_desc, shash, __ctx,
> + char ctx[];
> + );
> };
> +static_assert(offsetof(struct sdesc, shash.__ctx) == offsetof(struct sdesc, ctx));
This isn't even used. Just delete it:
---8<---
The ctx array in struct sdesc is never used. Delete it as it's
bogus since the previous member ends with a flexible array.
Reported-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 511a27c91813..1d433dae9955 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1443,7 +1443,6 @@ static void drbg_kcapi_set_entropy(struct crypto_rng *tfm,
#if defined(CONFIG_CRYPTO_DRBG_HASH) || defined(CONFIG_CRYPTO_DRBG_HMAC)
struct sdesc {
struct shash_desc shash;
- char ctx[];
};
static int drbg_init_hash_kernel(struct drbg_state *drbg)
--
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