From: Herbert Xu <herbert@gondor.apana.org.au>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org,
Stephan Mueller <smueller@chronox.de>
Subject: [v2 PATCH] crypto: drbg - Delete unused ctx from struct sdesc
Date: Wed, 19 Nov 2025 12:38:22 +0800 [thread overview]
Message-ID: <aR1JvnpTBomcKAMZ@gondor.apana.org.au> (raw)
In-Reply-To: <aRHCKMGDbWkXIY8f@kspp>
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@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2025-11-19 4:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 10:44 [PATCH][next] crypto: drbg - Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-11-19 4:38 ` Herbert Xu [this message]
2025-11-19 4:47 ` [v2 PATCH] crypto: drbg - Delete unused ctx from struct sdesc Gustavo A. R. Silva
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=aR1JvnpTBomcKAMZ@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=gustavoars@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smueller@chronox.de \
/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®