]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
powerpc/rtas: Replace one-element array with flexible array member
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 13 Aug 2025 10:30:59 +0000 (12:30 +0200)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Tue, 2 Jun 2026 05:54:32 +0000 (11:24 +0530)
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.

Link: https://github.com/KSPP/linux/issues/79
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250813103101.163698-2-thorsten.blum@linux.dev
arch/powerpc/include/asm/rtas-types.h

index 9d5b16803cbbb27a4d1dcb41dc955a9d0b79ff4a..5d40d187b9659f58a317c8e3ec29e18c26323158 100644 (file)
@@ -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