From: Simon Glass <simon.glass@canonical.com> Move DEFINE_RAW_FLEX macro from ext4_uboot.h to linux/overflow.h where it belongs alongside struct_size() and other size helpers. In the kernel this macro allocates a flexible array struct on the stack. In U-Boot it is stubbed to NULL since the code paths that use it are not exercised. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 4 ---- include/linux/overflow.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index ad3e59a7f6c..04ed9c3c846 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -297,10 +297,6 @@ int sync_filesystem(void *sb); #include <asm-generic/timex.h> #include <linux/nospec.h> -/* DEFINE_RAW_FLEX - define a flexible array struct on the stack (stubbed to NULL) */ -#define DEFINE_RAW_FLEX(type, name, member, count) \ - type *name = NULL - /* * Stubs for page-io.c - bio types are in linux/bio.h */ diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 672377ede42..75e8ad44ecf 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -20,4 +20,16 @@ #define struct_size(p, member, count) \ (sizeof(*(p)) + sizeof((p)->member[0]) * (count)) +/** + * DEFINE_RAW_FLEX() - Define a flexible array struct on the stack + * @type: Structure type containing flexible array + * @name: Variable name for the struct pointer + * @member: Name of the flexible array member + * @count: Number of elements + * + * In the kernel this allocates on stack; U-Boot stubs it to NULL. + */ +#define DEFINE_RAW_FLEX(type, name, member, count) \ + type *name = NULL + #endif /* _LINUX_OVERFLOW_H */ -- 2.43.0