Skip to contentSkip to conversation

powerpc/rtas: Replace one-element array with flexible array member

PATCH RESEND Applied Thorsten Blum 2 participants 2 messages Aug 13, 2025 – Jun 19 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 powerpc/rtas: Replace one-element array with flexible array member

Replace the deprecated one-element array with a modern flexible array member in the struct rtas_error_log and add the __counted_by_be() compiler attribute to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

---
 arch/powerpc/include/asm/rtas-types.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/rtas-types.h +3 -2
index 9d5b16803cbb..5d40d187b965 100644
@@ -42,8 +42,9 @@ struct rtas_error_log {
 	 */
 	u8		byte3;			/* General event or error*/
 	__be32		extended_log_length;	/* length in bytes */
-	unsigned char	buffer[1];		/* Start of extended log */
-						/* Variable length.      */
+
+	/* Start of extended log, variable length */
+	unsigned char	buffer[] __counted_by_be(extended_log_length);
 };
 
 /* RTAS general extended event log, Version 6. The extended log starts
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Thorsten Blum

Replace the deprecated one-element array with a modern flexible array member in the struct rtas_error_log and add the __counted_by_be() compiler attribute to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Applied to powerpc/next.

[1/1] powerpc/rtas: Replace one-element array with flexible array member

      https://git.kernel.org/powerpc/c/ab8bbf8024b7434e2b630965fd373fba5b89f29f

cheers