]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: cmdlinepart: use a flexible array member
authorRosen Penev <rosenp@gmail.com>
Tue, 17 Mar 2026 00:35:17 +0000 (17:35 -0700)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 17 Mar 2026 09:28:14 +0000 (10:28 +0100)
This is already allocated properly. It's just using an extra pointer.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/parsers/cmdlinepart.c

index 504e5fa2b45b0e497413f995f94299d0f3d92821..4caf1b3804f291ec6b50e07e901c9100d6eecebe 100644 (file)
@@ -50,9 +50,9 @@
 
 struct cmdline_mtd_partition {
        struct cmdline_mtd_partition *next;
-       char *mtd_id;
        int num_parts;
        struct mtd_partition *parts;
+       char mtd_id[];
 };
 
 /* mtdpart_setup() parses into here */
@@ -289,7 +289,6 @@ static int mtdpart_setup_real(char *s)
                /* enter results */
                this_mtd->parts = parts;
                this_mtd->num_parts = num_parts;
-               this_mtd->mtd_id = (char*)(this_mtd + 1);
                strscpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1);
 
                /* link into chain */