[PATCH v2][next] tls: Avoid -Wflex-array-member-not-at-end warning

Gustavo A. R. Silva posted 1 patch 1 week, 1 day ago
net/tls/tls.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2][next] tls: Avoid -Wflex-array-member-not-at-end warning
Posted by Gustavo A. R. Silva 1 week, 1 day ago
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.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
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(-)

diff --git a/net/tls/tls.h b/net/tls/tls.h
index 4e077068e6d9..06d462c57284 100644
--- a/net/tls/tls.h
+++ b/net/tls/tls.h
@@ -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);
-- 
2.43.0