Commit a2f02c99 authored by GONG, Ruiqi's avatar GONG, Ruiqi Committed by Florian Westphal

netfilter: ebtables: replace zero-length array members

As suggested by Kees[1], replace the old-style 0-element array members
of multiple structs in ebtables.h with modern C99 flexible array.

[1]: https://lore.kernel.org/all/5E8E0F9C-EE3F-4B0D-B827-DC47397E2A4A@kernel.org/

[ fw@strlen.de:
  keep struct ebt_entry_target as-is, causes compiler warning:
  "variable sized type 'struct ebt_entry_target' not at the end of a
  struct or class is a GNU extension" ]

Link: https://github.com/KSPP/linux/issues/21Signed-off-by: default avatarGONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
parent a7ed3465
...@@ -87,7 +87,7 @@ struct ebt_entries { ...@@ -87,7 +87,7 @@ struct ebt_entries {
/* nr. of entries */ /* nr. of entries */
unsigned int nentries; unsigned int nentries;
/* entry list */ /* entry list */
char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
}; };
/* used for the bitmask of struct ebt_entry */ /* used for the bitmask of struct ebt_entry */
...@@ -129,7 +129,7 @@ struct ebt_entry_match { ...@@ -129,7 +129,7 @@ struct ebt_entry_match {
} u; } u;
/* size of data */ /* size of data */
unsigned int match_size; unsigned int match_size;
unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); unsigned char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
}; };
struct ebt_entry_watcher { struct ebt_entry_watcher {
...@@ -142,7 +142,7 @@ struct ebt_entry_watcher { ...@@ -142,7 +142,7 @@ struct ebt_entry_watcher {
} u; } u;
/* size of data */ /* size of data */
unsigned int watcher_size; unsigned int watcher_size;
unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); unsigned char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
}; };
struct ebt_entry_target { struct ebt_entry_target {
...@@ -190,7 +190,7 @@ struct ebt_entry { ...@@ -190,7 +190,7 @@ struct ebt_entry {
/* sizeof ebt_entry + matches + watchers + target */ /* sizeof ebt_entry + matches + watchers + target */
unsigned int next_offset; unsigned int next_offset;
); );
unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); unsigned char elems[] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
}; };
static __inline__ struct ebt_entry_target * static __inline__ struct ebt_entry_target *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment