[Unstable/N][PATCH] UBUNTU: SAUCE: modpost: Replace 0-length array with flex-array member
Juerg Haefliger
juerg.haefliger at canonical.com
Thu Feb 22 18:45:00 UTC 2024
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 at canonical.com>
---
include/linux/module.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/module.h b/include/linux/module.h
index 20b1e8429656..382f2d73afa9 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -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;
--
2.40.1
More information about the kernel-team
mailing list