tls: Avoid -Wflex-array-member-not-at-end warning
Subsystems (3)
PATCH v2 1/1 tls: Avoid -Wflex-array-member-not-at-end warning
Remove unused flexible-array member in struct tls_rec and, with this, fix the following warning:
net/tls/tls.h:131:29: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Also, add a comment to prevent people from adding any members after struct aead_request, which is a flexible structure --this is a structure that ends in a flexible-array member.
---
Changes in v2:
- Remove unused flex array. (Sabrina Dubroca).
- Update changelog text.
v1:
- Link: https://lore.kernel.org/linux-hardening/aNFfmBLEoDSBSLJe@kspp/
net/tls/tls.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tls/tls.h +2 -1
@@ -128,8 +128,9 @@ struct tls_rec {char aad_space[TLS_AAD_SPACE_SIZE ];u8 iv_data[TLS_MAX_IV_SIZE ]; + +/* Must be last --ends in a flexible-array member. */ struct aead_request aead_req; -u8 aead_req_ctx[]; };int __net_init tls_proc_init (struct net *net);
Signature · 1 line
2.43.0
Thanks for the updated patch.
A process nit: the correct subject prefix for this type of work within networking would be [PATCH net-next v2] (indicating it targets the "net-next" tree).
Quoted 8 lines · Gustavo A. R. Silva
Remove unused flexible-array member in struct
tls_recand, with this, fix the following warning:
net/tls/tls.h:131:29: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]Also, add a comment to prevent people from adding any members after struct
aead_request, which is a flexible structure --this is a structure that ends in a flexible-array member.
Once that warning is enabled, re-adding a field after aead_req will not be allowed by the compiler, right? The comment is probably not really needed, but since there are "must be first" comments all over include/net, I guess it's useful.
Signature · 1 line
Sabrina
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Tue, 23 Sep 2025 22:45:10 +0200 you wrote:
Remove unused flexible-array member in struct
tls_recand, with this, fix the following warning:
net/tls/tls.h:131:29: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]Also, add a comment to prevent people from adding any members after struct
aead_request, which is a flexible structure --this is a structure that ends in a flexible-array member.[...]
Here is the summary with links:
- [v2,next] tls: Avoid -Wflex-array-member-not-at-end warning
https://git.kernel.org/netdev/net-next/c/b6db19d1df8a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html