linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: zstd - replace zero-length array with flexible array member
@ 2025-07-03 17:19 Thorsten Blum
  2025-07-03 21:57 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-07-03 17:19 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nick Terrell, David Sterba
  Cc: linux-hardening, Thorsten Blum, linux-crypto, linux-kernel

Replace the deprecated zero-length array with a modern flexible array
member in the struct zstd_ctx.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 crypto/zstd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/zstd.c b/crypto/zstd.c
index 657e0cf7b952..c489976c3e8b 100644
--- a/crypto/zstd.c
+++ b/crypto/zstd.c
@@ -25,7 +25,7 @@ struct zstd_ctx {
 	zstd_dctx *dctx;
 	size_t wksp_size;
 	zstd_parameters params;
-	u8 wksp[0] __aligned(8);
+	u8 wksp[] __aligned(8);
 };
 
 static DEFINE_MUTEX(zstd_stream_lock);
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: zstd - replace zero-length array with flexible array member
  2025-07-03 17:19 [PATCH] crypto: zstd - replace zero-length array with flexible array member Thorsten Blum
@ 2025-07-03 21:57 ` Kees Cook
  2025-07-03 22:46   ` Thorsten Blum
  2025-07-08 14:14 ` David Sterba
  2025-07-10  8:18 ` Herbert Xu
  2 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2025-07-03 21:57 UTC (permalink / raw)
  To: Thorsten Blum, Suman Kumar Chakraborty
  Cc: Herbert Xu, David S. Miller, Nick Terrell, David Sterba,
	linux-hardening, linux-crypto, linux-kernel

On Thu, Jul 03, 2025 at 07:19:34PM +0200, Thorsten Blum wrote:
> Replace the deprecated zero-length array with a modern flexible array
> member in the struct zstd_ctx.

Oh, weird. This is a very recent change. This should include:

Fixes: f5ad93ffb541 ("crypto: zstd - convert to acomp")

> 
> No functional changes intended.
> 
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  crypto/zstd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/zstd.c b/crypto/zstd.c
> index 657e0cf7b952..c489976c3e8b 100644
> --- a/crypto/zstd.c
> +++ b/crypto/zstd.c
> @@ -25,7 +25,7 @@ struct zstd_ctx {
>  	zstd_dctx *dctx;
>  	size_t wksp_size;
>  	zstd_parameters params;
> -	u8 wksp[0] __aligned(8);
> +	u8 wksp[] __aligned(8);

And likely, to use __counted_by(wksp_size)

I'm surprised checkpatch.pl didn't warn, but I guess the __aligned
confused the script?

Reviewed-by: Kees Cook <kees@kernel.org>

-Kees

>  };
>  
>  static DEFINE_MUTEX(zstd_stream_lock);
> -- 
> 2.50.0
> 
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: zstd - replace zero-length array with flexible array member
  2025-07-03 21:57 ` Kees Cook
@ 2025-07-03 22:46   ` Thorsten Blum
  0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-07-03 22:46 UTC (permalink / raw)
  To: Kees Cook
  Cc: Suman Kumar Chakraborty, Herbert Xu, David S. Miller,
	Nick Terrell, David Sterba, linux-hardening, linux-crypto,
	linux-kernel

On 3. Jul 2025, at 23:57, Kees Cook wrote:
> And likely, to use __counted_by(wksp_size)

I hesitated because semantically "size" isn't a "count" although the
values are the same here.

> Reviewed-by: Kees Cook <kees@kernel.org>

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: zstd - replace zero-length array with flexible array member
  2025-07-03 17:19 [PATCH] crypto: zstd - replace zero-length array with flexible array member Thorsten Blum
  2025-07-03 21:57 ` Kees Cook
@ 2025-07-08 14:14 ` David Sterba
  2025-07-10  8:18 ` Herbert Xu
  2 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2025-07-08 14:14 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Herbert Xu, David S. Miller, Nick Terrell, David Sterba,
	linux-hardening, linux-crypto, linux-kernel

On Thu, Jul 03, 2025 at 07:19:34PM +0200, Thorsten Blum wrote:
> Replace the deprecated zero-length array with a modern flexible array
> member in the struct zstd_ctx.
> 
> No functional changes intended.
> 
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  crypto/zstd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/zstd.c b/crypto/zstd.c
> index 657e0cf7b952..c489976c3e8b 100644
> --- a/crypto/zstd.c
> +++ b/crypto/zstd.c
> @@ -25,7 +25,7 @@ struct zstd_ctx {
>  	zstd_dctx *dctx;
>  	size_t wksp_size;
>  	zstd_parameters params;
> -	u8 wksp[0] __aligned(8);
> +	u8 wksp[] __aligned(8);

This is from patch "crypto: zstd - convert to acomp" currently as commit
f5ad93ffb54119a8dc in linux-next. Should it rather be folded there? It's
part of the crypto queue.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: zstd - replace zero-length array with flexible array member
  2025-07-03 17:19 [PATCH] crypto: zstd - replace zero-length array with flexible array member Thorsten Blum
  2025-07-03 21:57 ` Kees Cook
  2025-07-08 14:14 ` David Sterba
@ 2025-07-10  8:18 ` Herbert Xu
  2 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2025-07-10  8:18 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: David S. Miller, Nick Terrell, David Sterba, linux-hardening,
	linux-crypto, linux-kernel

On Thu, Jul 03, 2025 at 07:19:34PM +0200, Thorsten Blum wrote:
> Replace the deprecated zero-length array with a modern flexible array
> member in the struct zstd_ctx.
> 
> No functional changes intended.
> 
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  crypto/zstd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-10  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 17:19 [PATCH] crypto: zstd - replace zero-length array with flexible array member Thorsten Blum
2025-07-03 21:57 ` Kees Cook
2025-07-03 22:46   ` Thorsten Blum
2025-07-08 14:14 ` David Sterba
2025-07-10  8:18 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).