UBUNTU: SAUCE: modpost: Replace 0-length array with flex-array member

Fake flexible arrays (zero-length and one-element arrays) are deprecated,
and should be replaced by flexible-array members. This fixes the following
compiler warning:

 CC      kernel/module/version.o
../kernel/module/version.c: In function 'check_version':
../kernel/module/version.c:37:21: warning: 'strcmp' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
   37 |                 if (strcmp(versions->name, symname) != 0)
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../kernel/module/version.c:8:
../include/linux/module.h:41:14: note: source object 'name' of size 0
   41 |         char name[0];
      |              ^~~~

Fixes: 08bc01030daa ("UBUNTU: SAUCE: modpost: support arbitrary symbol length in modversion")
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Juerg Haefliger
2024-02-22 19:45:00 +01:00
committed by Paolo Pisati
parent 2f004a47f1
commit 9f9563d7cb
+1 -1
View File
@@ -38,7 +38,7 @@ struct modversion_info {
/* Offset of the next modversion entry in relation to this one. */
u32 next;
u32 crc;
char name[0];
char name[]; /* Flexible array member */
} __packed;
struct module;