linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] add warnings for flexible arrays
@ 2020-09-30 23:18 Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 01/13] flex-array: add testcases Luc Van Oostenryck
                   ` (13 more replies)
  0 siblings, 14 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Flexible array members have some restrictions (must be last
in a structure, not in a union) and a number of dangerous or
non-sensical usage (in an array, in nested structure or even
using sizeof() on the containing structure). Sparse currently
supports flexible array members but barely and doesn't help
finding bugs related to them. This series aims at improving this:
* fix structure alignment in the presence of a flexible array member
* issue an error if the flexible array is not last or in a union
* add an option to issue a warning:
  * on arrays of such 'flexible structures'
  * when using sizeof() on the containing structure
  * when declaring nested aggregate types with a flexible array member
  * if the flexible array adds some padding to the structure

When used on the kernel (v5.9-rc1) this results in no errors but
the following number of warnings:
      90 array of flexible structures
    5719 using sizeof on a flexible structure
    1909 flexible array member has padding
     888 nested flexible arrays

So, to begin with, the corresponding warning flags default to
	-Wflexible-array-array
	-Wno-flexible-array-nested
	-Wno-flexible-array-padding
	-Wno-flexible-array-sizeof

Notes:  implicit sizeof() on such 'flexible structures' like here
	under are not yet checked:
		struct s {
			...
			int flex[];
		} *dst, *src;
		...
		*dst = *src


Luc Van Oostenryck (13):
  flex-array: add testcases
  flex-array: factor out common part of lay_out_{struct,union}()
  flex-array: do not lay out invalid struct members
  flex-array: flexible array members have zero size and alignment is OK
  flex-array: detect structures with a flexible array member
  flex-array: warn on flexible arrays in unions
  flex-array: warn if flexible array is not last
  flex-array: identify structures with a flexible array member
  flex-array: add helper has_flexible_array()
  flex-array: warn when using sizeof() on a flexible array
  flex-array: warn an arrays containing a flexible array
  flex-array: warn on flexible array in nested aggregate types
  flex-array: warn when a flexible array member has some padding

 evaluate.c                      |  3 ++
 options.c                       |  8 ++++++
 options.h                       |  4 +++
 sparse.1                        | 27 ++++++++++++++++++
 symbol.c                        | 50 +++++++++++++++++++++------------
 symbol.h                        |  8 ++++++
 validation/flex-array-align.c   | 18 ++++++++++++
 validation/flex-array-array.c   | 15 ++++++++++
 validation/flex-array-error.c   | 26 +++++++++++++++++
 validation/flex-array-nested.c  | 29 +++++++++++++++++++
 validation/flex-array-padding.c | 21 ++++++++++++++
 validation/flex-array-sizeof.c  | 18 ++++++++++++
 12 files changed, 209 insertions(+), 18 deletions(-)
 create mode 100644 validation/flex-array-align.c
 create mode 100644 validation/flex-array-array.c
 create mode 100644 validation/flex-array-error.c
 create mode 100644 validation/flex-array-nested.c
 create mode 100644 validation/flex-array-padding.c
 create mode 100644 validation/flex-array-sizeof.c

-- 
2.28.0


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 01/13] flex-array: add testcases
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 02/13] flex-array: factor out common part of lay_out_{struct,union}() Luc Van Oostenryck
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/flex-array-align.c   | 19 +++++++++++++++++++
 validation/flex-array-array.c   | 16 ++++++++++++++++
 validation/flex-array-error.c   | 27 +++++++++++++++++++++++++++
 validation/flex-array-nested.c  | 30 ++++++++++++++++++++++++++++++
 validation/flex-array-padding.c | 22 ++++++++++++++++++++++
 validation/flex-array-sizeof.c  | 19 +++++++++++++++++++
 6 files changed, 133 insertions(+)
 create mode 100644 validation/flex-array-align.c
 create mode 100644 validation/flex-array-array.c
 create mode 100644 validation/flex-array-error.c
 create mode 100644 validation/flex-array-nested.c
 create mode 100644 validation/flex-array-padding.c
 create mode 100644 validation/flex-array-sizeof.c

diff --git a/validation/flex-array-align.c b/validation/flex-array-align.c
new file mode 100644
index 000000000000..0cc67ab36997
--- /dev/null
+++ b/validation/flex-array-align.c
@@ -0,0 +1,19 @@
+struct s {
+	__INT32_TYPE__ x;
+	__INT16_TYPE__ y;
+	unsigned char f[];
+};
+
+static int foo(struct s *s)
+{
+	return (sizeof(*s) << 16) | __builtin_offsetof(typeof(*s), f);
+}
+
+/*
+ * check-name: flex-array-align
+ * check-command: test-linearize -Wno-flexible-array-sizeof $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$0x80006
+ */
diff --git a/validation/flex-array-array.c b/validation/flex-array-array.c
new file mode 100644
index 000000000000..bda80d7a0a20
--- /dev/null
+++ b/validation/flex-array-array.c
@@ -0,0 +1,16 @@
+struct s {
+	int i;
+	long f[];
+};
+
+static struct s a[2];
+
+/*
+ * check-name: flex-array-array
+ * check-command: sparse -Wflexible-array-array $file
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-array.c:6:18: warning: array of flexible structures
+ * check-error-end
+ */
diff --git a/validation/flex-array-error.c b/validation/flex-array-error.c
new file mode 100644
index 000000000000..89601e42daf6
--- /dev/null
+++ b/validation/flex-array-error.c
@@ -0,0 +1,27 @@
+struct s {
+	int i;
+	long f[];
+	int j;
+};
+
+union u {
+	int i;
+	long f[];
+};
+
+// trigger the examination of the offending types
+static int foo(struct s *s, union u *u)
+{
+	return    __builtin_offsetof(typeof(*s), i)
+		+ __builtin_offsetof(typeof(*u), i);
+}
+
+/*
+ * check-name: flex-array-error
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-error.c:3:14: error: flexible array member 'f' is not last
+flex-array-error.c:9:14: error: flexible array member 'f' in a union
+ * check-error-end
+ */
diff --git a/validation/flex-array-nested.c b/validation/flex-array-nested.c
new file mode 100644
index 000000000000..3503c329d7c3
--- /dev/null
+++ b/validation/flex-array-nested.c
@@ -0,0 +1,30 @@
+struct f {
+	int i;
+	long f[];
+};
+
+struct s {
+	struct f f;
+};
+
+union u {
+	struct f f;
+};
+
+// trigger the examination of the offending types
+static int foo(struct s *s, union u *u)
+{
+	return    __builtin_offsetof(typeof(*s), f)
+		+ __builtin_offsetof(typeof(*u), f);
+}
+
+/*
+ * check-name: flex-array-nested
+ * check-command: sparse -Wflexible-array-nested $file
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-nested.c:6:8: warning: nested flexible arrays
+flex-array-nested.c:10:7: warning: nested flexible arrays
+ * check-error-end
+ */
diff --git a/validation/flex-array-padding.c b/validation/flex-array-padding.c
new file mode 100644
index 000000000000..2ba77971266e
--- /dev/null
+++ b/validation/flex-array-padding.c
@@ -0,0 +1,22 @@
+struct s {
+	__INT32_TYPE__ x;
+	__INT16_TYPE__ y;
+	unsigned char f[];
+};
+
+static int foo(struct s *s)
+{
+	return __builtin_offsetof(typeof(*s), f);
+}
+
+/*
+ * check-name: flex-array-padding
+ * check-command: test-linearize -Wflexible-array-padding $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ *
+ * check-error-start
+flex-array-padding.c:4:23: warning: flexible array member has padding
+ * check-error-end
+ */
diff --git a/validation/flex-array-sizeof.c b/validation/flex-array-sizeof.c
new file mode 100644
index 000000000000..3359509d0084
--- /dev/null
+++ b/validation/flex-array-sizeof.c
@@ -0,0 +1,19 @@
+struct s {
+	int i;
+	long f[];
+};
+
+static int foo(struct s *s)
+{
+	return sizeof(*s);
+}
+
+/*
+ * check-name: flex-array-sizeof
+ * check-command: sparse -Wflexible-array-sizeof $file
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-sizeof.c:8:16: warning: using sizeof on a flexible structure
+ * check-error-end
+ */
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 02/13] flex-array: factor out common part of lay_out_{struct,union}()
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 01/13] flex-array: add testcases Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 03/13] flex-array: do not lay out invalid struct members Luc Van Oostenryck
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

This is a preparatory step for later patches.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/symbol.c b/symbol.c
index 7f0c85580f06..365351a0a756 100644
--- a/symbol.c
+++ b/symbol.c
@@ -94,14 +94,6 @@ struct struct_union_info {
  */
 static void lay_out_union(struct symbol *sym, struct struct_union_info *info)
 {
-	examine_symbol_type(sym);
-
-	// Unnamed bitfields do not affect alignment.
-	if (sym->ident || !is_bitfield_type(sym)) {
-		if (sym->ctype.alignment > info->max_align)
-			info->max_align = sym->ctype.alignment;
-	}
-
 	if (sym->bit_size > info->bit_size)
 		info->bit_size = sym->bit_size;
 
@@ -125,14 +117,6 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
 	unsigned long bit_size, align_bit_mask;
 	int base_size;
 
-	examine_symbol_type(sym);
-
-	// Unnamed bitfields do not affect alignment.
-	if (sym->ident || !is_bitfield_type(sym)) {
-		if (sym->ctype.alignment > info->max_align)
-			info->max_align = sym->ctype.alignment;
-	}
-
 	bit_size = info->bit_size;
 	base_size = sym->bit_size; 
 
@@ -196,6 +180,14 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 			sparse_error(member->pos, "member '%s' has __auto_type", show_ident(member->ident));
 			member->ctype.base_type = &incomplete_ctype;
 		}
+		examine_symbol_type(member);
+
+		if (member->ctype.alignment > info.max_align) {
+			// Unnamed bitfields do not affect alignment.
+			if (member->ident || !is_bitfield_type(member))
+				info.max_align = member->ctype.alignment;
+		}
+
 		fn(member, &info);
 	} END_FOR_EACH_PTR(member);
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 03/13] flex-array: do not lay out invalid struct members
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 01/13] flex-array: add testcases Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 02/13] flex-array: factor out common part of lay_out_{struct,union}() Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 04/13] flex-array: flexible array members have zero size and alignment is OK Luc Van Oostenryck
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Do not bother trying to lay out invalid struct members,
ignore them as it will avoid to special case them later.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/symbol.c b/symbol.c
index 365351a0a756..4c93a0fb4880 100644
--- a/symbol.c
+++ b/symbol.c
@@ -121,10 +121,12 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
 	base_size = sym->bit_size; 
 
 	/*
-	 * Unsized arrays cause us to not align the resulting
-	 * structure size
+	 * If the member is unsized, either it's a flexible array or
+	 * it's invalid and a warning has already been issued.
 	 */
 	if (base_size < 0) {
+		if (!is_array_type(sym))
+			return;
 		info->align_size = 0;
 		base_size = 0;
 	}
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 04/13] flex-array: flexible array members have zero size and alignment is OK
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (2 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 03/13] flex-array: do not lay out invalid struct members Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 05/13] flex-array: detect structures with a flexible array member Luc Van Oostenryck
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

When doing the layout of structures, flexible arrays used to
not align the resulting structure size.

However, the standard specify that while for most purposes
flexible arrays can be handled as if not present, they still
may add some trailing padding (cfr. C11's 6.7.2.1p18).

So, there is no reason to reset the alignment.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c                      | 1 -
 validation/flex-array-align.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/symbol.c b/symbol.c
index 4c93a0fb4880..9acffeea7fad 100644
--- a/symbol.c
+++ b/symbol.c
@@ -127,7 +127,6 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
 	if (base_size < 0) {
 		if (!is_array_type(sym))
 			return;
-		info->align_size = 0;
 		base_size = 0;
 	}
 
diff --git a/validation/flex-array-align.c b/validation/flex-array-align.c
index 0cc67ab36997..9f28942a1ee1 100644
--- a/validation/flex-array-align.c
+++ b/validation/flex-array-align.c
@@ -12,7 +12,6 @@ static int foo(struct s *s)
 /*
  * check-name: flex-array-align
  * check-command: test-linearize -Wno-flexible-array-sizeof $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-contains: ret\\..*\\$0x80006
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 05/13] flex-array: detect structures with a flexible array member
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (3 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 04/13] flex-array: flexible array members have zero size and alignment is OK Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 06/13] flex-array: warn on flexible arrays in unions Luc Van Oostenryck
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

This is a preparatory step for doing the checks and warnings.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/symbol.c b/symbol.c
index 9acffeea7fad..6633e89de4a9 100644
--- a/symbol.c
+++ b/symbol.c
@@ -87,6 +87,7 @@ struct struct_union_info {
 	unsigned long max_align;
 	unsigned long bit_size;
 	int align_size;
+	struct symbol *flex_array;
 };
 
 /*
@@ -128,6 +129,7 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
 		if (!is_array_type(sym))
 			return;
 		base_size = 0;
+		info->flex_array = sym;
 	}
 
 	align_bit_mask = bytes_to_bits(sym->ctype.alignment) - 1;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 06/13] flex-array: warn on flexible arrays in unions
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (4 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 05/13] flex-array: detect structures with a flexible array member Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 07/13] flex-array: warn if flexible array is not last Luc Van Oostenryck
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Flexible array members are not allowed in unions.
So, warn if one is present.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/symbol.c b/symbol.c
index 6633e89de4a9..e578b1a840a3 100644
--- a/symbol.c
+++ b/symbol.c
@@ -95,6 +95,9 @@ struct struct_union_info {
  */
 static void lay_out_union(struct symbol *sym, struct struct_union_info *info)
 {
+	if (sym->bit_size < 0 && is_array_type(sym))
+		sparse_error(sym->pos, "flexible array member '%s' in a union", show_ident(sym->ident));
+
 	if (sym->bit_size > info->bit_size)
 		info->bit_size = sym->bit_size;
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 07/13] flex-array: warn if flexible array is not last
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (5 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 06/13] flex-array: warn on flexible arrays in unions Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 08/13] flex-array: identify structures with a flexible array member Luc Van Oostenryck
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Flexible array members must be the last in a structure.
Warn if it is not the case.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c                      | 2 ++
 validation/flex-array-error.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/symbol.c b/symbol.c
index e578b1a840a3..b4c5e471372b 100644
--- a/symbol.c
+++ b/symbol.c
@@ -186,6 +186,8 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 			sparse_error(member->pos, "member '%s' has __auto_type", show_ident(member->ident));
 			member->ctype.base_type = &incomplete_ctype;
 		}
+		if (info.flex_array)
+			sparse_error(info.flex_array->pos, "flexible array member '%s' is not last", show_ident(info.flex_array->ident));
 		examine_symbol_type(member);
 
 		if (member->ctype.alignment > info.max_align) {
diff --git a/validation/flex-array-error.c b/validation/flex-array-error.c
index 89601e42daf6..2b7e6953050c 100644
--- a/validation/flex-array-error.c
+++ b/validation/flex-array-error.c
@@ -18,7 +18,6 @@ static int foo(struct s *s, union u *u)
 
 /*
  * check-name: flex-array-error
- * check-known-to-fail
  *
  * check-error-start
 flex-array-error.c:3:14: error: flexible array member 'f' is not last
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 08/13] flex-array: identify structures with a flexible array member
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (6 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 07/13] flex-array: warn if flexible array is not last Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 09/13] flex-array: add helper has_flexible_array() Luc Van Oostenryck
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Structures containing a flexible array must not be nested.
So, as a preparatory step, detect structures or union containing
a flexible array, possibly recursively and mark the corresponding
type with a dedicated flag.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 6 ++++++
 symbol.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/symbol.c b/symbol.c
index b4c5e471372b..bffdc135ba69 100644
--- a/symbol.c
+++ b/symbol.c
@@ -87,6 +87,7 @@ struct struct_union_info {
 	unsigned long max_align;
 	unsigned long bit_size;
 	int align_size;
+	char has_flex_array;
 	struct symbol *flex_array;
 };
 
@@ -206,6 +207,11 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 		bit_align = bytes_to_bits(sym->ctype.alignment)-1;
 		bit_size = (bit_size + bit_align) & ~bit_align;
 	}
+	if (info.flex_array) {
+		info.has_flex_array = 1;
+	}
+	if (info.has_flex_array)
+		sym->has_flex_array = 1;
 	sym->bit_size = bit_size;
 	return sym;
 }
diff --git a/symbol.h b/symbol.h
index a3ed95678ee5..287df0a3a0ee 100644
--- a/symbol.h
+++ b/symbol.h
@@ -185,6 +185,7 @@ struct symbol {
 					examined:1,
 					expanding:1,
 					evaluated:1,
+					has_flex_array:1,
 					string:1,
 					designated_init:1,
 					forced_arg:1,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 09/13] flex-array: add helper has_flexible_array()
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (7 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 08/13] flex-array: identify structures with a flexible array member Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 10/13] flex-array: warn when using sizeof() on a flexible array Luc Van Oostenryck
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

This will make later checks easier & clearer.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/symbol.h b/symbol.h
index 287df0a3a0ee..c9e6c7fe4439 100644
--- a/symbol.h
+++ b/symbol.h
@@ -507,6 +507,13 @@ static inline int is_extern_inline(struct symbol *sym)
 		is_function(sym->ctype.base_type);
 }
 
+static inline int has_flexible_array(struct symbol *type)
+{
+	if (type->type == SYM_NODE)
+		type = type->ctype.base_type;
+	return type->has_flex_array;
+}
+
 static inline int get_sym_type(struct symbol *type)
 {
 	if (type->type == SYM_NODE)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 10/13] flex-array: warn when using sizeof() on a flexible array
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (8 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 09/13] flex-array: add helper has_flexible_array() Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 11/13] flex-array: warn an arrays containing " Luc Van Oostenryck
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

Using sizeof() on a structure containing a flexible array
will ignore the 'flexible' part. This is maybe what is expected
but maybe not, so add an option -Wflexible-array-sizeof to
warn on such usage.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c                     | 3 +++
 options.c                      | 2 ++
 options.h                      | 1 +
 sparse.1                       | 7 +++++++
 validation/flex-array-sizeof.c | 1 -
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/evaluate.c b/evaluate.c
index c1ef348a475e..cfbb6ada4153 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2253,6 +2253,9 @@ static struct symbol *evaluate_sizeof(struct expression *expr)
 		size = bits_in_char;
 	}
 
+	if (has_flexible_array(type) && Wflexible_array_sizeof)
+		warning(expr->pos, "using sizeof on a flexible structure");
+
 	if (is_array_type(type) && size < 0) {	// VLA, 1-dimension only
 		struct expression *base, *size;
 		struct symbol *base_type;
diff --git a/options.c b/options.c
index 294dfd3be77a..ce88fbf6ed61 100644
--- a/options.c
+++ b/options.c
@@ -100,6 +100,7 @@ int Wdesignated_init = 1;
 int Wdo_while = 0;
 int Wenum_mismatch = 1;
 int Wexternal_function_has_definition = 1;
+int Wflexible_array_sizeof = 0;
 int Wimplicit_int = 1;
 int Winit_cstring = 0;
 int Wint_to_pointer_cast = 1;
@@ -840,6 +841,7 @@ static const struct flag warnings[] = {
 	{ "do-while", &Wdo_while },
 	{ "enum-mismatch", &Wenum_mismatch },
 	{ "external-function-has-definition", &Wexternal_function_has_definition },
+	{ "flexible-array-sizeof", &Wflexible_array_sizeof },
 	{ "implicit-int", &Wimplicit_int },
 	{ "init-cstring", &Winit_cstring },
 	{ "int-to-pointer-cast", &Wint_to_pointer_cast },
diff --git a/options.h b/options.h
index abdf08645ad2..feb351a36c9e 100644
--- a/options.h
+++ b/options.h
@@ -99,6 +99,7 @@ extern int Wdesignated_init;
 extern int Wdo_while;
 extern int Wenum_mismatch;
 extern int Wexternal_function_has_definition;
+extern int Wflexible_array_sizeof;
 extern int Wimplicit_int;
 extern int Winit_cstring;
 extern int Wint_to_pointer_cast;
diff --git a/sparse.1 b/sparse.1
index 48dab7a9a5c1..5f98df33a231 100644
--- a/sparse.1
+++ b/sparse.1
@@ -257,6 +257,13 @@ Sparse issues these warnings by default.  To turn them off, use
 \fB\-Wno\-external\-function\-has\-definition\fR.
 .
 .TP
+.B -Wflexible-array-sizeof
+Warn about using the sizeof operator on a structure containing a flexible array,
+possibly recursively.
+
+Sparse does not issue these warnings by default.
+.
+.TP
 .B \-Winit\-cstring
 Warn about initialization of a char array with a too long constant C string.
 
diff --git a/validation/flex-array-sizeof.c b/validation/flex-array-sizeof.c
index 3359509d0084..05394e19a6b2 100644
--- a/validation/flex-array-sizeof.c
+++ b/validation/flex-array-sizeof.c
@@ -11,7 +11,6 @@ static int foo(struct s *s)
 /*
  * check-name: flex-array-sizeof
  * check-command: sparse -Wflexible-array-sizeof $file
- * check-known-to-fail
  *
  * check-error-start
 flex-array-sizeof.c:8:16: warning: using sizeof on a flexible structure
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 11/13] flex-array: warn an arrays containing a flexible array
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (9 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 10/13] flex-array: warn when using sizeof() on a flexible array Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 12/13] flex-array: warn on flexible array in nested aggregate types Luc Van Oostenryck
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

An array of some aggregate type containing, possibly recursively,
a flexible array is pretty non-sensical. So, add an option
-Wflexible-array-array to warn on such usage.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 options.c                     | 2 ++
 options.h                     | 1 +
 sparse.1                      | 7 +++++++
 symbol.c                      | 2 ++
 validation/flex-array-array.c | 1 -
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/options.c b/options.c
index ce88fbf6ed61..a8129ac1e952 100644
--- a/options.c
+++ b/options.c
@@ -100,6 +100,7 @@ int Wdesignated_init = 1;
 int Wdo_while = 0;
 int Wenum_mismatch = 1;
 int Wexternal_function_has_definition = 1;
+int Wflexible_array_array = 1;
 int Wflexible_array_sizeof = 0;
 int Wimplicit_int = 1;
 int Winit_cstring = 0;
@@ -841,6 +842,7 @@ static const struct flag warnings[] = {
 	{ "do-while", &Wdo_while },
 	{ "enum-mismatch", &Wenum_mismatch },
 	{ "external-function-has-definition", &Wexternal_function_has_definition },
+	{ "flexible-array-array", &Wflexible_array_array },
 	{ "flexible-array-sizeof", &Wflexible_array_sizeof },
 	{ "implicit-int", &Wimplicit_int },
 	{ "init-cstring", &Winit_cstring },
diff --git a/options.h b/options.h
index feb351a36c9e..7bcf925b6912 100644
--- a/options.h
+++ b/options.h
@@ -99,6 +99,7 @@ extern int Wdesignated_init;
 extern int Wdo_while;
 extern int Wenum_mismatch;
 extern int Wexternal_function_has_definition;
+extern int Wflexible_array_array;
 extern int Wflexible_array_sizeof;
 extern int Wimplicit_int;
 extern int Winit_cstring;
diff --git a/sparse.1 b/sparse.1
index 5f98df33a231..c1a74153c618 100644
--- a/sparse.1
+++ b/sparse.1
@@ -257,6 +257,13 @@ Sparse issues these warnings by default.  To turn them off, use
 \fB\-Wno\-external\-function\-has\-definition\fR.
 .
 .TP
+.B -Wflexible-array-array
+Warn about arrays of structures containing a flexible array.
+
+Sparse issues these warnings by default. To turn them off, use
+\fB-Wno-flexible-array-array\fR.
+.
+.TP
 .B -Wflexible-array-sizeof
 Warn about using the sizeof operator on a structure containing a flexible array,
 possibly recursively.
diff --git a/symbol.c b/symbol.c
index bffdc135ba69..02b9066e966a 100644
--- a/symbol.c
+++ b/symbol.c
@@ -267,6 +267,8 @@ static struct symbol * examine_array_type(struct symbol *sym)
 			bit_size = -1;
 		}
 	}
+	if (has_flexible_array(base_type) && Wflexible_array_array)
+		warning(sym->pos, "array of flexible structures");
 	alignment = base_type->ctype.alignment;
 	if (!sym->ctype.alignment)
 		sym->ctype.alignment = alignment;
diff --git a/validation/flex-array-array.c b/validation/flex-array-array.c
index bda80d7a0a20..921a0698bb28 100644
--- a/validation/flex-array-array.c
+++ b/validation/flex-array-array.c
@@ -8,7 +8,6 @@ static struct s a[2];
 /*
  * check-name: flex-array-array
  * check-command: sparse -Wflexible-array-array $file
- * check-known-to-fail
  *
  * check-error-start
 flex-array-array.c:6:18: warning: array of flexible structures
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 12/13] flex-array: warn on flexible array in nested aggregate types
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (10 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 11/13] flex-array: warn an arrays containing " Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-09-30 23:18 ` [PATCH 13/13] flex-array: warn when a flexible array member has some padding Luc Van Oostenryck
  2020-10-01 16:36 ` [PATCH 00/13] add warnings for flexible arrays Linus Torvalds
  13 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

A structure or a union containing another aggregate type containing,
possibly recursively, a flexible array is quite error prone and make
not much sense. So, add an option -Wflexible-array-nested to warn
on such usage.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 options.c                      | 2 ++
 options.h                      | 1 +
 sparse.1                       | 7 +++++++
 symbol.c                       | 4 ++++
 validation/flex-array-nested.c | 1 -
 5 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/options.c b/options.c
index a8129ac1e952..b46900b973a6 100644
--- a/options.c
+++ b/options.c
@@ -101,6 +101,7 @@ int Wdo_while = 0;
 int Wenum_mismatch = 1;
 int Wexternal_function_has_definition = 1;
 int Wflexible_array_array = 1;
+int Wflexible_array_nested = 0;
 int Wflexible_array_sizeof = 0;
 int Wimplicit_int = 1;
 int Winit_cstring = 0;
@@ -843,6 +844,7 @@ static const struct flag warnings[] = {
 	{ "enum-mismatch", &Wenum_mismatch },
 	{ "external-function-has-definition", &Wexternal_function_has_definition },
 	{ "flexible-array-array", &Wflexible_array_array },
+	{ "flexible-array-nested", &Wflexible_array_nested },
 	{ "flexible-array-sizeof", &Wflexible_array_sizeof },
 	{ "implicit-int", &Wimplicit_int },
 	{ "init-cstring", &Winit_cstring },
diff --git a/options.h b/options.h
index 7bcf925b6912..d23ed472eaac 100644
--- a/options.h
+++ b/options.h
@@ -100,6 +100,7 @@ extern int Wdo_while;
 extern int Wenum_mismatch;
 extern int Wexternal_function_has_definition;
 extern int Wflexible_array_array;
+extern int Wflexible_array_nested;
 extern int Wflexible_array_sizeof;
 extern int Wimplicit_int;
 extern int Winit_cstring;
diff --git a/sparse.1 b/sparse.1
index c1a74153c618..9b1a59c6b9d4 100644
--- a/sparse.1
+++ b/sparse.1
@@ -264,6 +264,13 @@ Sparse issues these warnings by default. To turn them off, use
 \fB-Wno-flexible-array-array\fR.
 .
 .TP
+.B -Wflexible-array-nested
+Warn about structures containing a flexible array being contained into
+another structure, union or array.
+
+Sparse does not issue these warnings by default.
+.
+.TP
 .B -Wflexible-array-sizeof
 Warn about using the sizeof operator on a structure containing a flexible array,
 possibly recursively.
diff --git a/symbol.c b/symbol.c
index 02b9066e966a..a9f646eb053f 100644
--- a/symbol.c
+++ b/symbol.c
@@ -197,6 +197,10 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 				info.max_align = member->ctype.alignment;
 		}
 
+		if (has_flexible_array(member))
+			info.has_flex_array = 1;
+		if (has_flexible_array(member) && Wflexible_array_nested)
+			warning(sym->pos, "nested flexible arrays");
 		fn(member, &info);
 	} END_FOR_EACH_PTR(member);
 
diff --git a/validation/flex-array-nested.c b/validation/flex-array-nested.c
index 3503c329d7c3..63767683c56a 100644
--- a/validation/flex-array-nested.c
+++ b/validation/flex-array-nested.c
@@ -21,7 +21,6 @@ static int foo(struct s *s, union u *u)
 /*
  * check-name: flex-array-nested
  * check-command: sparse -Wflexible-array-nested $file
- * check-known-to-fail
  *
  * check-error-start
 flex-array-nested.c:6:8: warning: nested flexible arrays
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (11 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 12/13] flex-array: warn on flexible array in nested aggregate types Luc Van Oostenryck
@ 2020-09-30 23:18 ` Luc Van Oostenryck
  2020-10-01 16:34   ` Linus Torvalds
  2020-10-01 16:36 ` [PATCH 00/13] add warnings for flexible arrays Linus Torvalds
  13 siblings, 1 reply; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-09-30 23:18 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

If some padding is added because of the presence of a flexible
array member, the size of the structure will be greater than
the offset of this flexible array which can cause some
problems if the assumption is made that these 2 size must be
identical (which is easy to do since such flexible arrays are
conceptually 'after' the structure itself).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 options.c                       | 2 ++
 options.h                       | 1 +
 sparse.1                        | 6 ++++++
 symbol.c                        | 2 ++
 validation/flex-array-padding.c | 1 -
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/options.c b/options.c
index b46900b973a6..92d64e6ab64e 100644
--- a/options.c
+++ b/options.c
@@ -102,6 +102,7 @@ int Wenum_mismatch = 1;
 int Wexternal_function_has_definition = 1;
 int Wflexible_array_array = 1;
 int Wflexible_array_nested = 0;
+int Wflexible_array_padding = 0;
 int Wflexible_array_sizeof = 0;
 int Wimplicit_int = 1;
 int Winit_cstring = 0;
@@ -845,6 +846,7 @@ static const struct flag warnings[] = {
 	{ "external-function-has-definition", &Wexternal_function_has_definition },
 	{ "flexible-array-array", &Wflexible_array_array },
 	{ "flexible-array-nested", &Wflexible_array_nested },
+	{ "flexible-array-padding", &Wflexible_array_padding },
 	{ "flexible-array-sizeof", &Wflexible_array_sizeof },
 	{ "implicit-int", &Wimplicit_int },
 	{ "init-cstring", &Winit_cstring },
diff --git a/options.h b/options.h
index d23ed472eaac..31d9c5859977 100644
--- a/options.h
+++ b/options.h
@@ -101,6 +101,7 @@ extern int Wenum_mismatch;
 extern int Wexternal_function_has_definition;
 extern int Wflexible_array_array;
 extern int Wflexible_array_nested;
+extern int Wflexible_array_padding;
 extern int Wflexible_array_sizeof;
 extern int Wimplicit_int;
 extern int Winit_cstring;
diff --git a/sparse.1 b/sparse.1
index 9b1a59c6b9d4..8c61e869dc57 100644
--- a/sparse.1
+++ b/sparse.1
@@ -268,6 +268,12 @@ Sparse issues these warnings by default. To turn them off, use
 Warn about structures containing a flexible array being contained into
 another structure, union or array.
 
+Sparse does not issue these warnings by default.
+.
+.TP
+.B -Wflexible-array-padding
+Warn about padding alignments caused by the presence of a flexible array member.
+
 Sparse does not issue these warnings by default.
 .
 .TP
diff --git a/symbol.c b/symbol.c
index a9f646eb053f..eabb2226651f 100644
--- a/symbol.c
+++ b/symbol.c
@@ -213,6 +213,8 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 	}
 	if (info.flex_array) {
 		info.has_flex_array = 1;
+		if (sym->offset != bits_to_bytes(bit_size) && Wflexible_array_padding)
+			warning(info.flex_array->pos, "flexible array member has padding");
 	}
 	if (info.has_flex_array)
 		sym->has_flex_array = 1;
diff --git a/validation/flex-array-padding.c b/validation/flex-array-padding.c
index 2ba77971266e..95b349e1199a 100644
--- a/validation/flex-array-padding.c
+++ b/validation/flex-array-padding.c
@@ -12,7 +12,6 @@ static int foo(struct s *s)
 /*
  * check-name: flex-array-padding
  * check-command: test-linearize -Wflexible-array-padding $file
- * check-known-to-fail
  *
  * check-output-ignore
  *
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-09-30 23:18 ` [PATCH 13/13] flex-array: warn when a flexible array member has some padding Luc Van Oostenryck
@ 2020-10-01 16:34   ` Linus Torvalds
  2020-10-01 19:17     ` Luc Van Oostenryck
  0 siblings, 1 reply; 20+ messages in thread
From: Linus Torvalds @ 2020-10-01 16:34 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Sparse Mailing-list

On Wed, Sep 30, 2020 at 4:18 PM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> If some padding is added because of the presence of a flexible
> array member, the size of the structure will be greater than
> the offset of this flexible array which can cause some
> problems if the assumption is made that these 2 size must be
> identical (which is easy to do since such flexible arrays are
> conceptually 'after' the structure itself).

The warning seems pointless, and the explanation above is wrong.

Flexible array padding is normal and good. IOW, if you have

    struct odd_struct {
        char c;
        unsigned int flex[];
    };

then the flexible array - and the structure - very much should be
aligned on 'unsigned int', and both the offset of the flex-array and
the (bogus) size of the structure is 4.

So this is a normal case and nothing wrong with it, and the above is
the "flexible array caused padding" one (but sizeof and offsetof
match).

And the case that causes sizeof() and offsetof() to not match is
normal too: but is not that the flexible array member caused padding,
but that *other* members did.

IOW, maybe you have a structure like this:

    struct other {
        uint64_t a;
        uint32_t b;
        char flex[];
    };

and now "offsetof(flex)" is 12, but "sizeof(struct other)" is 16,
because the flex-array itself has no real alignment requirement and
will just be laid out after the 12 bytes of a/b, but the structure has
8-byte alignment due to 'a'.

So I don't think the warning is interesting, because this is a
perfectly normal condition too.

And I don't think your explanation for the warning makes sense,
because you say "padding is added because of the presence of a
flexible array member", but that's not at all what is going on. The
padding is added because of *other* members.

Anyway, the above is just an example of why "sizeof()" itself makes no
sense on these things. A "sizeof()" of a structure with a flexible
array member is inherently pointless. You can't use it for anything
really valid, and it doesn't have any sensible meaning.

But I don't think that has anything to do with warning about padding.
The padding is right - it's the sizeof() itself that is nonsensical.

So in the kernel, we would

 - start warning about 'sizeof(flex_struct)'

 - make our "struct_size(s, m, N)" construct use
"offsetof(m)+N*sizeof(*m)" instead of using sizeof().

Of course, it may well be that we end up with trouble just because we
end up _needing_ sizeof() for some reason. I can't think of any sane
situation off the top of my head, but who knows what odd macros etc we
might have that end up doing sizeof() as part of things..

                  Linus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 00/13] add warnings for flexible arrays
  2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
                   ` (12 preceding siblings ...)
  2020-09-30 23:18 ` [PATCH 13/13] flex-array: warn when a flexible array member has some padding Luc Van Oostenryck
@ 2020-10-01 16:36 ` Linus Torvalds
  13 siblings, 0 replies; 20+ messages in thread
From: Linus Torvalds @ 2020-10-01 16:36 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Sparse Mailing-list

On Wed, Sep 30, 2020 at 4:18 PM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> Flexible array members have some restrictions (must be last
> in a structure, not in a union) and a number of dangerous or
> non-sensical usage (in an array, in nested structure or even
> using sizeof() on the containing structure).

Thanks, this looks good apart from the one patch I reacted to. Maybe
you had some other reason for that patch, and it's just the commit
message that needs fixing, but as it is now I think that patch didn't
make much sense..

                Linus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-10-01 16:34   ` Linus Torvalds
@ 2020-10-01 19:17     ` Luc Van Oostenryck
  2020-10-01 19:27       ` Linus Torvalds
  0 siblings, 1 reply; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-10-01 19:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Sparse Mailing-list

On Thu, Oct 01, 2020 at 09:34:37AM -0700, Linus Torvalds wrote:
> On Wed, Sep 30, 2020 at 4:18 PM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > If some padding is added because of the presence of a flexible
> > array member, the size of the structure will be greater than
> > the offset of this flexible array which can cause some
> > problems if the assumption is made that these 2 size must be
> > identical (which is easy to do since such flexible arrays are
> > conceptually 'after' the structure itself).
> 
> The warning seems pointless, and the explanation above is wrong.
> 
> Flexible array padding is normal and good. IOW, if you have
> 
>     struct odd_struct {
>         char c;
>         unsigned int flex[];
>     };
> 
> then the flexible array - and the structure - very much should be
> aligned on 'unsigned int', and both the offset of the flex-array and
> the (bogus) size of the structure is 4.
> 
> So this is a normal case and nothing wrong with it, and the above is
> the "flexible array caused padding" one (but sizeof and offsetof
> match).
> 
> And the case that causes sizeof() and offsetof() to not match is
> normal too: but is not that the flexible array member caused padding,
> but that *other* members did.
> 
> IOW, maybe you have a structure like this:
> 
>     struct other {
>         uint64_t a;
>         uint32_t b;
>         char flex[];
>     };
> 
> and now "offsetof(flex)" is 12, but "sizeof(struct other)" is 16,
> because the flex-array itself has no real alignment requirement and
> will just be laid out after the 12 bytes of a/b, but the structure has
> 8-byte alignment due to 'a'.
> 
> So I don't think the warning is interesting, because this is a
> perfectly normal condition too.
> 
> And I don't think your explanation for the warning makes sense,
> because you say "padding is added because of the presence of a
> flexible array member", but that's not at all what is going on. The
> padding is added because of *other* members.

Yes, my explanation is completely wrong. The warning is indeed just
about sizeof() != offset() and I added because it seemed odd to me
but ...

> Anyway, the above is just an example of why "sizeof()" itself makes no
> sense on these things. A "sizeof()" of a structure with a flexible
> array member is inherently pointless. You can't use it for anything
> really valid, and it doesn't have any sensible meaning.
> 
> But I don't think that has anything to do with warning about padding.
> The padding is right - it's the sizeof() itself that is nonsensical.

Yes, indeed, it's perfectly normal. I'll drop this patch.
 
> So in the kernel, we would
> 
>  - start warning about 'sizeof(flex_struct)'

Adding this warning by default annoys me slightly because it will
add 5700+ warnings to the 18000 already present and I think sparse
is already underused because it is very/too noisy. But I guess that
most occurrences come from a few macros and thus should be easy to
get rid off.

>  - make our "struct_size(s, m, N)" construct use
> "offsetof(m)+N*sizeof(*m)" instead of using sizeof().

This accounts for only 432 occurences of sizeof(flex-array),
leaving 5287 other ones.

> Of course, it may well be that we end up with trouble just because we
> end up _needing_ sizeof() for some reason. I can't think of any sane
> situation off the top of my head, but who knows what odd macros etc we
> might have that end up doing sizeof() as part of things..

Well, yes, for my part, I find the number of nested flexible arrays a
bit worrying and much less sensical than the sizeof but .. live and see.

-- Luc

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-10-01 19:17     ` Luc Van Oostenryck
@ 2020-10-01 19:27       ` Linus Torvalds
  2020-10-01 19:41         ` Luc Van Oostenryck
  0 siblings, 1 reply; 20+ messages in thread
From: Linus Torvalds @ 2020-10-01 19:27 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Sparse Mailing-list

On Thu, Oct 1, 2020 at 12:17 PM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> > So in the kernel, we would
> >
> >  - start warning about 'sizeof(flex_struct)'
>
> Adding this warning by default annoys me slightly because it will
> add 5700+ warnings to the 18000 already present and I think sparse
> is already underused because it is very/too noisy. But I guess that
> most occurrences come from a few macros and thus should be easy to
> get rid off.

Hopefully. I'll try to take a look. Do you have the sparse changes in
a git branch already so that I can just try that directly?

Or if you send me a couple of examples, maybe it's just the same
pattern over and over,..

            Linus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-10-01 19:27       ` Linus Torvalds
@ 2020-10-01 19:41         ` Luc Van Oostenryck
  2020-10-01 19:51           ` Luc Van Oostenryck
  0 siblings, 1 reply; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-10-01 19:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Sparse Mailing-list

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]

On Thu, Oct 01, 2020 at 12:27:56PM -0700, Linus Torvalds wrote:
> On Thu, Oct 1, 2020 at 12:17 PM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > > So in the kernel, we would
> > >
> > >  - start warning about 'sizeof(flex_struct)'
> >
> > Adding this warning by default annoys me slightly because it will
> > add 5700+ warnings to the 18000 already present and I think sparse
> > is already underused because it is very/too noisy. But I guess that
> > most occurrences come from a few macros and thus should be easy to
> > get rid off.
> 
> Hopefully. I'll try to take a look. Do you have the sparse changes in
> a git branch already so that I can just try that directly?

What I posted yesterday is on
	git://git.kernel.org/pub/scm/devel/sparse/sparse-dev.git flex-array

> Or if you send me a couple of examples, maybe it's just the same
> pattern over and over,..

Well, the 888 occurences I see are already 'unique' occurences
(in the sense that the warning is from a distinct file+position).
I'm adding in attachment the extract of my test logs (but it is
on v5.9-rc1 so it's maybe not much usefull). I ddn't investigated
anything, just checked a few case to see that it was a genuine
occurrence.

-- Luc

[-- Attachment #2: nested-flex-array.txt --]
[-- Type: text/plain, Size: 71231 bytes --]

    268 ./include/net/ip.h:44:8: warning: nested flexible arrays
    228 ./include/linux/tty.h:85:8: warning: nested flexible arrays
    228 ./include/linux/tty.h:230:8: warning: nested flexible arrays
    219 ./include/crypto/hash.h:231:8: warning: nested flexible arrays
    141 ./include/linux/ieee80211.h:1119:39: warning: nested flexible arrays
    141 ./include/linux/ieee80211.h:1103:31: warning: nested flexible arrays
    141 ./include/linux/ieee80211.h:1101:24: warning: nested flexible arrays
    141 ./include/linux/ieee80211.h:1047:15: warning: nested flexible arrays
    141 ./include/linux/ieee80211.h:1040:8: warning: nested flexible arrays
    134 ./include/crypto/skcipher.h:37:8: warning: nested flexible arrays
    129 net/mac80211/ieee80211_i.h:871:8: warning: nested flexible arrays
    121 net/mac80211/sta_info.h:535:8: warning: nested flexible arrays
    102 ./include/crypto/aead.h:152:8: warning: nested flexible arrays
    100 fs/ocfs2/ocfs2_fs.h:725:15: warning: nested flexible arrays
     88 drivers/net/wireless/marvell/mwifiex/fw.h:2309:15: warning: nested flexible arrays
     74 ./include/crypto/hash.h:216:8: warning: nested flexible arrays
     63 ./include/net/inet_sock.h:58:8: warning: nested flexible arrays
     61 ./include/linux/serial_core.h:285:8: warning: nested flexible arrays
     59 net/wireless/core.h:24:8: warning: nested flexible arrays
     56 drivers/md/bcache/bcache.h:507:8: warning: nested flexible arrays
     56 ./include/linux/console_struct.h:94:8: warning: nested flexible arrays
     55 ./include/net/tcp.h:872:23: warning: nested flexible arrays
     55 ./include/net/tcp.h:859:15: warning: nested flexible arrays
     55 ./include/net/tcp.h:825:8: warning: nested flexible arrays
     51 ./include/linux/usb/serial.h:72:8: warning: nested flexible arrays
     47 ./include/net/flow_offload.h:377:8: warning: nested flexible arrays
     46 ./include/crypto/skcipher.h:43:8: warning: nested flexible arrays
     44 ./include/net/xfrm.h:589:15: warning: nested flexible arrays
     44 ./include/net/xfrm.h:588:8: warning: nested flexible arrays
     42 drivers/md/bcache/bcache.h:231:8: warning: nested flexible arrays
     39 ./include/linux/crypto.h:639:8: warning: nested flexible arrays
     37 net/mac80211/key.h:59:8: warning: nested flexible arrays
     36 fs/ext4/ext4.h:2188:16: warning: nested flexible arrays
     36 ./include/rdma/ib_verbs.h:2055:7: warning: nested flexible arrays
     36 ./include/crypto/internal/aead.h:21:24: warning: nested flexible arrays
     36 ./include/crypto/internal/aead.h:20:15: warning: nested flexible arrays
     36 ./include/crypto/internal/aead.h:18:8: warning: nested flexible arrays
     35 arch/x86/events/intel/../perf_event.h:199:8: warning: nested flexible arrays
     34 net/wireless/core.h:150:8: warning: nested flexible arrays
     30 net/mac80211/ieee80211_i.h:836:8: warning: nested flexible arrays
     26 drivers/net/wireless/ath/ath10k/htt.h:1811:15: warning: nested flexible arrays
     26 ./include/net/xfrm.h:661:8: warning: nested flexible arrays
     26 ./include/net/sctp/structs.h:1548:8: warning: nested flexible arrays
     26 ./include/linux/sctp.h:275:8: warning: nested flexible arrays
     24 net/mac80211/ieee80211_i.h:797:8: warning: nested flexible arrays
     24 drivers/md/bcache/journal.h:128:8: warning: nested flexible arrays
     24 drivers/md/bcache/bcache.h:407:8: warning: nested flexible arrays
     24 ./include/net/mac80211.h:2572:8: warning: nested flexible arrays
     24 ./include/linux/hyperv.h:725:8: warning: nested flexible arrays
     24 ./include/linux/hyperv.h:685:8: warning: nested flexible arrays
     24 ./include/linux/errqueue.h:15:15: warning: nested flexible arrays
     24 ./include/linux/errqueue.h:14:8: warning: nested flexible arrays
     24 ./include/linux/cgroup-defs.h:494:8: warning: nested flexible arrays
     24 ./include/acpi/actypes.h:1156:8: warning: nested flexible arrays
     23 ./include/crypto/internal/skcipher.h:22:24: warning: nested flexible arrays
     23 ./include/crypto/internal/skcipher.h:21:15: warning: nested flexible arrays
     23 ./include/crypto/internal/skcipher.h:19:8: warning: nested flexible arrays
     22 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h:219:8: warning: nested flexible arrays
     21 ./include/crypto/rng.h:54:8: warning: nested flexible arrays
     21 ./include/crypto/akcipher.h:48:8: warning: nested flexible arrays
     20 fs/ocfs2/ocfs2_fs.h:662:8: warning: nested flexible arrays
     20 ./include/net/xfrm.h:607:8: warning: nested flexible arrays
     20 ./include/net/inet_sock.h:63:8: warning: nested flexible arrays
     19 security/apparmor/include/policy.h:129:8: warning: nested flexible arrays
     19 ./include/net/xfrm.h:629:8: warning: nested flexible arrays
     18 ./include/crypto/internal/hash.h:46:24: warning: nested flexible arrays
     18 ./include/crypto/internal/hash.h:45:15: warning: nested flexible arrays
     18 ./include/crypto/internal/hash.h:43:8: warning: nested flexible arrays
     16 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h:235:15: warning: nested flexible arrays
     16 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h:232:17: warning: nested flexible arrays
     16 drivers/net/ethernet/aquantia/atlantic/aq_hw.h:173:8: warning: nested flexible arrays
     16 drivers/md/bcache/bcache.h:298:8: warning: nested flexible arrays
     16 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/dbg-tlv.h:219:8: warning: nested flexible arrays
     15 ./include/crypto/kpp.h:42:8: warning: nested flexible arrays
     14 fs/dlm/dlm_internal.h:518:8: warning: nested flexible arrays
     14 drivers/md/bcache/journal.h:119:9: warning: nested flexible arrays
     14 drivers/md/bcache/journal.h:104:8: warning: nested flexible arrays
     14 drivers/md/bcache/bcache.h:675:9: warning: nested flexible arrays
     14 drivers/md/bcache/bcache.h:227:9: warning: nested flexible arrays
     14 drivers/md/bcache/bcache.h:225:8: warning: nested flexible arrays
     14 ./include/linux/pci.h:297:8: warning: nested flexible arrays
     13 ./include/crypto/internal/scompress.h:15:8: warning: nested flexible arrays
     12 ./include/net/udp.h:40:15: warning: nested flexible arrays
     12 ./include/net/udp.h:39:8: warning: nested flexible arrays
     12 ./include/linux/jbd2.h:1603:16: warning: nested flexible arrays
     11 drivers/nvme/target/nvmet.h:323:24: warning: nested flexible arrays
     11 drivers/nvme/target/nvmet.h:322:15: warning: nested flexible arrays
     11 drivers/nvme/target/nvmet.h:313:8: warning: nested flexible arrays
     11 drivers/net/wireless/marvell/mwifiex/fw.h:2304:8: warning: nested flexible arrays
     11 drivers/net/wireless/marvell/mwifiex/fw.h:1149:8: warning: nested flexible arrays
     11 ./drivers/net/wireless/intel/iwlwifi/dvm/..//fw/api/dbg-tlv.h:219:8: warning: nested flexible arrays
     10 sound/usb/caiaq/device.h:60:8: warning: nested flexible arrays
     10 drivers/net/wireless/ath/carl9170/fwcmd.h:230:15: warning: nested flexible arrays
     10 drivers/net/wireless/ath/carl9170/fwcmd.h:228:8: warning: nested flexible arrays
     10 drivers/net/wireless/ath/carl9170/carl9170.h:375:15: warning: nested flexible arrays
     10 drivers/net/wireless/ath/carl9170/carl9170.h:233:8: warning: nested flexible arrays
     10 drivers/md/bcache/bset.h:157:8: warning: nested flexible arrays
     10 ./include/sound/intel-nhlt.h:66:8: warning: nested flexible arrays
     10 ./include/pcmcia/cistpl.h:533:15: warning: nested flexible arrays
      9 drivers/md/bcache/btree.h:122:9: warning: nested flexible arrays
      9 drivers/md/bcache/btree.h:117:8: warning: nested flexible arrays
      9 ./include/linux/crypto.h:643:8: warning: nested flexible arrays
      9 ./include/crypto/acompress.h:47:8: warning: nested flexible arrays
      8 net/dccp/dccp.h:339:15: warning: nested flexible arrays
      8 net/dccp/dccp.h:338:8: warning: nested flexible arrays
      8 fs/ocfs2/ocfs2_fs.h:968:15: warning: nested flexible arrays
      8 fs/ocfs2/ocfs2_fs.h:898:24: warning: nested flexible arrays
      8 fs/ocfs2/ocfs2_fs.h:896:15: warning: nested flexible arrays
      8 fs/ocfs2/ocfs2_fs.h:878:8: warning: nested flexible arrays
      8 drivers/scsi/hisi_sas/hisi_sas.h:565:15: warning: nested flexible arrays
      8 drivers/net/wireless/intel/iwlegacy/common.h:549:8: warning: nested flexible arrays
      8 drivers/net/wireless/intel/iwlegacy/commands.h:3335:8: warning: nested flexible arrays
      8 drivers/net/wireless/intel/iwlegacy/commands.h:1195:8: warning: nested flexible arrays
      8 drivers/md/dm-rq.h:27:8: warning: nested flexible arrays
      8 drivers/md/bcache/bcache.h:738:8: warning: nested flexible arrays
      8 drivers/infiniband/hw/i40iw/i40iw_cm.h:354:15: warning: nested flexible arrays
      8 crypto/gcm.c:71:15: warning: nested flexible arrays
      8 crypto/ccm.c:46:15: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:2020:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:2007:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1992:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1978:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1963:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1949:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1931:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1906:8: warning: nested flexible arrays
      8 ./include/rdma/ib_verbs.h:1892:8: warning: nested flexible arrays
      8 ./include/net/cfg80211.h:2830:8: warning: nested flexible arrays
      8 ./include/crypto/internal/akcipher.h:16:24: warning: nested flexible arrays
      8 ./include/crypto/internal/akcipher.h:15:15: warning: nested flexible arrays
      8 ./include/crypto/internal/akcipher.h:13:8: warning: nested flexible arrays
      7 fs/btrfs/volumes.h:289:8: warning: nested flexible arrays
      7 drivers/net/wireless/ti/wl1251/acx.h:16:8: warning: nested flexible arrays
      7 drivers/clk/samsung/clk.h:22:8: warning: nested flexible arrays
      7 ./include/linux/mlx5/mlx5_ifc.h:3363:8: warning: nested flexible arrays
      6 fs/ocfs2/ocfs2_fs.h:844:15: warning: nested flexible arrays
      6 fs/ocfs2/ocfs2_fs.h:505:8: warning: nested flexible arrays
      6 fs/ocfs2/ocfs2_fs.h:1083:15: warning: nested flexible arrays
      6 fs/cifs/cifsglob.h:135:8: warning: nested flexible arrays
      6 drivers/scsi/aic94xx/aic94xx_sas.h:574:15: warning: nested flexible arrays
      6 drivers/scsi/aic94xx/aic94xx_sas.h:572:8: warning: nested flexible arrays
      6 drivers/scsi/aic94xx/aic94xx_sas.h:319:8: warning: nested flexible arrays
      6 drivers/net/wireless/wl3501.h:382:8: warning: nested flexible arrays
      6 drivers/net/wireless/wl3501.h:309:8: warning: nested flexible arrays
      6 drivers/net/wireless/ti/wlcore/acx.h:54:8: warning: nested flexible arrays
      6 drivers/md/raid5.h:249:16: warning: nested flexible arrays
      6 ./include/uapi/linux/bcache.h:345:8: warning: nested flexible arrays
      6 ./include/linux/mlx5/mlx5_ifc.h:7681:8: warning: nested flexible arrays
      6 ./include/linux/mlx5/mlx5_ifc.h:3265:8: warning: nested flexible arrays
      6 ./include/linux/ceph/osdmap.h:144:15: warning: nested flexible arrays
      6 ./include/crypto/if_alg.h:109:15: warning: nested flexible arrays
      5 drivers/scsi/qla2xxx/qla_dbg.h:301:15: warning: nested flexible arrays
      5 drivers/scsi/qla2xxx/qla_dbg.h:276:8: warning: nested flexible arrays
      5 drivers/scsi/isci/request.h:82:8: warning: nested flexible arrays
      5 drivers/scsi/isci/request.h:137:31: warning: nested flexible arrays
      5 drivers/scsi/isci/request.h:132:24: warning: nested flexible arrays
      5 drivers/scsi/isci/request.h:131:15: warning: nested flexible arrays
      5 drivers/net/wireless/wl3501.h:439:8: warning: nested flexible arrays
      5 drivers/net/wireless/ti/wl1251/acx.h:149:8: warning: nested flexible arrays
      5 drivers/net/wireless/microchip/wilc1000/spi.c:52:15: warning: nested flexible arrays
      5 arch/x86/events/zhaoxin/../perf_event.h:199:8: warning: nested flexible arrays
      5 arch/x86/events/perf_event.h:199:8: warning: nested flexible arrays
      5 arch/x86/events/intel/../perf_event.h:794:24: warning: nested flexible arrays
      5 arch/x86/events/intel/../perf_event.h:792:15: warning: nested flexible arrays
      5 arch/x86/events/intel/../perf_event.h:789:8: warning: nested flexible arrays
      5 arch/x86/events/amd/../perf_event.h:199:8: warning: nested flexible arrays
      5 ./include/linux/mlx5/mlx5_ifc.h:7705:8: warning: nested flexible arrays
      5 ./include/linux/mlx5/mlx5_ifc.h:7627:8: warning: nested flexible arrays
      5 ./include/linux/iomap.h:191:8: warning: nested flexible arrays
      5 ./include/linux/ecryptfs.h:93:8: warning: nested flexible arrays
      5 ./include/linux/ecryptfs.h:100:15: warning: nested flexible arrays
      5 ./include/linux/ceph/ceph_fs.h:508:8: warning: nested flexible arrays
      5 ./include/crypto/internal/hash.h:35:24: warning: nested flexible arrays
      5 ./include/crypto/internal/hash.h:34:15: warning: nested flexible arrays
      5 ./include/crypto/internal/hash.h:32:8: warning: nested flexible arrays
      5 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/scan.h:827:15: warning: nested flexible arrays
      4 sound/core/vmaster.c:47:8: warning: nested flexible arrays
      4 net/xfrm/xfrm_input.c:32:15: warning: nested flexible arrays
      4 net/xfrm/xfrm_input.c:31:8: warning: nested flexible arrays
      4 net/ipv6/esp6.c:42:8: warning: nested flexible arrays
      4 net/ipv6/ah6.c:42:8: warning: nested flexible arrays
      4 net/ipv4/inet_fragment.c:36:15: warning: nested flexible arrays
      4 net/ipv4/inet_fragment.c:35:8: warning: nested flexible arrays
      4 net/ipv4/icmp.c:100:8: warning: nested flexible arrays
      4 net/ieee802154/core.h:7:8: warning: nested flexible arrays
      4 kernel/trace/trace_uprobe.c:55:8: warning: nested flexible arrays
      4 kernel/trace/trace_kprobe.c:55:8: warning: nested flexible arrays
      4 kernel/bpf/core.c:1857:15: warning: nested flexible arrays
      4 kernel/bpf/core.c:1843:15: warning: nested flexible arrays
      4 fs/squashfs/squashfs_fs.h:395:7: warning: nested flexible arrays
      4 fs/ocfs2/ocfs2_fs.h:942:8: warning: nested flexible arrays
      4 fs/notify/fdinfo.c:43:16: warning: nested flexible arrays
      4 fs/nfs_common/nfsacl.c:43:8: warning: nested flexible arrays
      4 fs/ext4/mballoc.c:2407:16: warning: nested flexible arrays
      4 fs/dlm/dlm_internal.h:455:7: warning: nested flexible arrays
      4 fs/block_dev.c:264:8: warning: nested flexible arrays
      4 drivers/scsi/hisi_sas/hisi_sas.h:587:8: warning: nested flexible arrays
      4 drivers/scsi/hisi_sas/hisi_sas.h:576:7: warning: nested flexible arrays
      4 drivers/scsi/hisi_sas/hisi_sas.h:566:24: warning: nested flexible arrays
      4 drivers/scsi/hisi_sas/hisi_sas.h:563:8: warning: nested flexible arrays
      4 drivers/pcmcia/pcmcia_cis.c:138:8: warning: nested flexible arrays
      4 drivers/net/wireless/ti/wlcore/acx.h:474:8: warning: nested flexible arrays
      4 drivers/net/wireless/intel/iwlegacy/common.h:551:15: warning: nested flexible arrays
      4 drivers/net/wireless/intel/iwlegacy/commands.h:3348:15: warning: nested flexible arrays
      4 drivers/net/ethernet/sfc/vfdi.h:167:15: warning: nested flexible arrays
      4 drivers/net/ethernet/aquantia/atlantic/hw_atl/../hw_atl/hw_atl_utils.h:235:15: warning: nested flexible arrays
      4 drivers/net/ethernet/aquantia/atlantic/hw_atl/../hw_atl/hw_atl_utils.h:232:17: warning: nested flexible arrays
      4 drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_hw.h:173:8: warning: nested flexible arrays
      4 drivers/md/dm.c:95:8: warning: nested flexible arrays
      4 drivers/md/dm.c:80:8: warning: nested flexible arrays
      4 drivers/md/bcache/bcache.h:740:15: warning: nested flexible arrays
      4 drivers/infiniband/hw/i40iw/i40iw_cm.h:315:8: warning: nested flexible arrays
      4 drivers/infiniband/hw/cxgb4/t4.h:98:7: warning: nested flexible arrays
      4 drivers/gpu/drm/amd/amdgpu/si_dpm.h:799:8: warning: nested flexible arrays
      4 drivers/firmware/efi/libstub/file.c:32:8: warning: nested flexible arrays
      4 drivers/firmware/efi/libstub/efi-stub-helper.c:428:21: warning: nested flexible arrays
      4 crypto/rsa-pkcs1pad.c:100:8: warning: nested flexible arrays
      4 crypto/gcm.c:98:16: warning: nested flexible arrays
      4 crypto/gcm.c:63:8: warning: nested flexible arrays
      4 crypto/gcm.c:53:8: warning: nested flexible arrays
      4 crypto/gcm.c:37:8: warning: nested flexible arrays
      4 crypto/drbg.c:1669:8: warning: nested flexible arrays
      4 crypto/ctr.c:22:8: warning: nested flexible arrays
      4 crypto/ccm.c:39:8: warning: nested flexible arrays
      4 crypto/ccm.c:33:8: warning: nested flexible arrays
      4 crypto/asymmetric_keys/restrict.c:19:15: warning: nested flexible arrays
      4 ./include/scsi/fc_encode.h:27:15: warning: nested flexible arrays
      4 ./include/net/sctp/structs.h:1117:15: warning: nested flexible arrays
      4 ./include/net/sctp/structs.h:1116:8: warning: nested flexible arrays
      4 ./include/net/nsh.h:213:15: warning: nested flexible arrays
      4 ./include/net/nsh.h:208:8: warning: nested flexible arrays
      4 ./include/linux/sctp.h:724:8: warning: nested flexible arrays
      4 ./include/linux/mlx5/mlx5_ifc.h:6331:8: warning: nested flexible arrays
      4 ./include/linux/mlx5/mlx5_ifc.h:6224:8: warning: nested flexible arrays
      3 sound/usb/6fire/comm.h:19:8: warning: nested flexible arrays
      3 net/netfilter/x_tables.c:796:8: warning: nested flexible arrays
      3 net/netfilter/x_tables.c:791:8: warning: nested flexible arrays
      3 fs/overlayfs/overlayfs.h:102:15: warning: nested flexible arrays
      3 fs/overlayfs/overlayfs.h:100:8: warning: nested flexible arrays
      3 fs/ocfs2/ocfs2_fs.h:815:8: warning: nested flexible arrays
      3 fs/ocfs2/ocfs2_fs.h:1066:8: warning: nested flexible arrays
      3 fs/ocfs2/ocfs2_fs.h:1046:8: warning: nested flexible arrays
      3 fs/ocfs2/ocfs2_fs.h:1033:8: warning: nested flexible arrays
      3 fs/f2fs/f2fs.h:1701:16: warning: nested flexible arrays
      3 drivers/tty/hvc/hvc_console.h:35:8: warning: nested flexible arrays
      3 drivers/staging/wlan-ng/hfa384x.h:1229:8: warning: nested flexible arrays
      3 drivers/staging/rtl8192u/ieee80211/ieee80211.h:977:8: warning: nested flexible arrays
      3 drivers/nvdimm/nd.h:163:8: warning: nested flexible arrays
      3 drivers/net/wireless/ti/wl18xx/../wlcore/acx.h:54:8: warning: nested flexible arrays
      3 drivers/net/wireless/ti/wl12xx/../wlcore/acx.h:54:8: warning: nested flexible arrays
      3 drivers/net/wireless/ath/ath10k/htt.h:1793:15: warning: nested flexible arrays
      3 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:664:15: warning: nested flexible arrays
      3 drivers/infiniband/hw/cxgb4/t4fw_ri_api.h:646:8: warning: nested flexible arrays
      3 drivers/infiniband/hw/cxgb4/t4.h:113:7: warning: nested flexible arrays
      3 drivers/gpu/drm/nouveau/nvif/notify.c:169:16: warning: nested flexible arrays
      3 drivers/gpu/drm/nouveau/nouveau_svm.c:73:8: warning: nested flexible arrays
      3 drivers/crypto/ccp/ccp-crypto.h:112:8: warning: nested flexible arrays
      3 drivers/clk/x86/clk-cgu.h:79:8: warning: nested flexible arrays
      3 ./include/uapi/linux/bcache.h:355:9: warning: nested flexible arrays
      3 ./include/uapi/linux/bcache.h:354:9: warning: nested flexible arrays
      3 ./include/scsi/scsi_bsg_iscsi.h:69:15: warning: nested flexible arrays
      3 ./include/scsi/scsi_bsg_iscsi.h:67:8: warning: nested flexible arrays
      3 ./include/linux/sctp.h:664:8: warning: nested flexible arrays
      3 ./include/linux/sctp.h:227:8: warning: nested flexible arrays
      3 ./include/linux/mlx5/mlx5_ifc.h:6297:8: warning: nested flexible arrays
      3 ./include/linux/mlx5/mlx5_ifc.h:4789:8: warning: nested flexible arrays
      3 ./include/linux/mlx5/mlx5_ifc.h:4227:8: warning: nested flexible arrays
      3 ./include/crypto/if_alg.h:95:8: warning: nested flexible arrays
      2 sound/usb/6fire/midi.h:15:8: warning: nested flexible arrays
      2 security/integrity/evm/evm.h:46:8: warning: nested flexible arrays
      2 net/nfc/hci/hci.h:21:8: warning: nested flexible arrays
      2 net/netfilter/nft_set_pipapo.h:175:8: warning: nested flexible arrays
      2 net/dccp/ccids/lib/../../dccp.h:339:15: warning: nested flexible arrays
      2 net/dccp/ccids/lib/../../dccp.h:338:8: warning: nested flexible arrays
      2 net/dccp/ccids/../dccp.h:339:15: warning: nested flexible arrays
      2 net/dccp/ccids/../dccp.h:338:8: warning: nested flexible arrays
      2 fs/xfs/xfs_rmap_item.h:46:8: warning: nested flexible arrays
      2 fs/xfs/xfs_refcount_item.h:45:8: warning: nested flexible arrays
      2 fs/xfs/xfs_log_priv.h:195:16: warning: nested flexible arrays
      2 fs/xfs/xfs_bmap_item.h:43:8: warning: nested flexible arrays
      2 fs/ocfs2/ocfs2_fs.h:858:8: warning: nested flexible arrays
      2 fs/notify/fanotify/fanotify.h:169:8: warning: nested flexible arrays
      2 fs/notify/fanotify/fanotify.h:155:8: warning: nested flexible arrays
      2 fs/ecryptfs/ecryptfs_kernel.h:364:8: warning: nested flexible arrays
      2 fs/cifs/smb2inode.c:50:8: warning: nested flexible arrays
      2 drivers/staging/rtl8192u/ieee80211/ieee80211.h:1008:8: warning: nested flexible arrays
      2 drivers/staging/rtl8192e/rtllib.h:824:8: warning: nested flexible arrays
      2 drivers/scsi/isci/task.h:88:15: warning: nested flexible arrays
      2 drivers/scsi/isci/task.h:84:8: warning: nested flexible arrays
      2 drivers/scsi/hisi_sas/hisi_sas.h:593:8: warning: nested flexible arrays
      2 drivers/net/wireless/wl3501.h:575:8: warning: nested flexible arrays
      2 drivers/net/wireless/ti/wlcore/wl12xx_80211.h:109:8: warning: nested flexible arrays
      2 drivers/net/wireless/ti/wl18xx/acx.h:266:8: warning: nested flexible arrays
      2 drivers/net/wireless/ti/wl12xx/acx.h:241:8: warning: nested flexible arrays
      2 drivers/net/wireless/ti/wl1251/wl12xx_80211.h:120:8: warning: nested flexible arrays
      2 drivers/net/wireless/ti/wl1251/acx.h:1060:8: warning: nested flexible arrays
      2 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1645:8: warning: nested flexible arrays
      2 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1569:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlwifi/mvm/sta.h:351:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h:246:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h:203:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h:178:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlegacy/commands.h:2662:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlegacy/3945.h:126:15: warning: nested flexible arrays
      2 drivers/net/wireless/intel/iwlegacy/3945.h:125:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/ipw2x00/libipw.h:477:8: warning: nested flexible arrays
      2 drivers/net/wireless/intel/ipw2x00/libipw.h:448:8: warning: nested flexible arrays
      2 drivers/net/wireless/ath/ath10k/htt.h:1809:8: warning: nested flexible arrays
      2 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h:59:8: warning: nested flexible arrays
      2 drivers/media/platform/xilinx/xilinx-dma.h:73:8: warning: nested flexible arrays
      2 drivers/md/bcache/request.h:5:8: warning: nested flexible arrays
      2 drivers/md/bcache/request.h:33:9: warning: nested flexible arrays
      2 drivers/md/bcache/request.c:463:8: warning: nested flexible arrays
      2 drivers/md/bcache/movinggc.c:15:8: warning: nested flexible arrays
      2 drivers/md/bcache/journal.h:83:8: warning: nested flexible arrays
      2 drivers/infiniband/sw/rdmavt/mr.h:53:8: warning: nested flexible arrays
      2 drivers/infiniband/hw/mlx5/fs.c:1058:23: warning: nested flexible arrays
      2 drivers/infiniband/hw/cxgb4/t4fw_ri_api.h:611:15: warning: nested flexible arrays
      2 drivers/infiniband/hw/cxgb4/t4fw_ri_api.h:598:8: warning: nested flexible arrays
      2 drivers/infiniband/hw/cxgb4/t4.h:392:8: warning: nested flexible arrays
      2 drivers/infiniband/core/uverbs_ioctl.c:43:8: warning: nested flexible arrays
      2 drivers/gpu/drm/nouveau/nvif/object.c:61:16: warning: nested flexible arrays
      2 drivers/gpu/drm/nouveau/nvif/object.c:266:16: warning: nested flexible arrays
      2 drivers/gpu/drm/nouveau/nvif/object.c:185:16: warning: nested flexible arrays
      2 drivers/gpu/drm/nouveau/nvif/object.c:142:16: warning: nested flexible arrays
      2 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h:293:7: warning: nested flexible arrays
      2 drivers/crypto/qce/cipher.h:34:8: warning: nested flexible arrays
      2 drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h:151:8: warning: nested flexible arrays
      2 drivers/block/rnbd/rnbd-srv-dev.h:22:8: warning: nested flexible arrays
      2 crypto/chacha20poly1305.c:64:15: warning: nested flexible arrays
      2 crypto/adiantum.c:101:15: warning: nested flexible arrays
      2 ./include/sound/intel-nhlt.h:56:8: warning: nested flexible arrays
      2 ./include/scsi/fc_encode.h:25:8: warning: nested flexible arrays
      2 ./include/net/sctp/structs.h:334:8: warning: nested flexible arrays
      2 ./include/net/nfc/nci.h:518:8: warning: nested flexible arrays
      2 ./include/linux/sctp.h:390:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:7729:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:7494:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:6414:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:6367:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:5680:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:3863:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:3403:8: warning: nested flexible arrays
      2 ./include/linux/mlx5/mlx5_ifc.h:10373:8: warning: nested flexible arrays
      2 ./include/linux/hyperv.h:1055:8: warning: nested flexible arrays
      2 ./include/linux/efi.h:923:15: warning: nested flexible arrays
      2 ./include/linux/efi.h:922:8: warning: nested flexible arrays
      2 ./include/linux/ceph/osdmap.h:140:8: warning: nested flexible arrays
      2 ./include/crypto/cryptd.h:52:8: warning: nested flexible arrays
      2 ./include/crypto/cryptd.h:33:8: warning: nested flexible arrays
      2 ./include/crypto/cryptd.h:21:8: warning: nested flexible arrays
      2 ./include/asm-generic/hyperv-tlfs.h:403:8: warning: nested flexible arrays
      2 ./include/asm-generic/hyperv-tlfs.h:352:8: warning: nested flexible arrays
      2 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/dbg.h:83:8: warning: nested flexible arrays
      1 sound/usb/misc/ua101.c:112:24: warning: nested flexible arrays
      1 sound/usb/hiface/pcm.c:24:8: warning: nested flexible arrays
      1 sound/usb/6fire/pcm.h:24:8: warning: nested flexible arrays
      1 sound/soc/intel/skylake/skl-i2s.h:80:8: warning: nested flexible arrays
      1 security/keys/trusted-keys/trusted_tpm1.c:37:8: warning: nested flexible arrays
      1 security/keys/dh.c:82:8: warning: nested flexible arrays
      1 security/integrity/ima/ima_template_lib.c:269:16: warning: nested flexible arrays
      1 security/integrity/ima/ima_main.c:752:16: warning: nested flexible arrays
      1 security/integrity/ima/ima_init.c:50:16: warning: nested flexible arrays
      1 security/integrity/ima/ima_api.c:220:16: warning: nested flexible arrays
      1 security/integrity/evm/../integrity.h:89:8: warning: nested flexible arrays
      1 net/sched/sch_taprio.c:84:8: warning: nested flexible arrays
      1 net/sched/sch_atm.c:64:8: warning: nested flexible arrays
      1 net/rxrpc/key.c:968:16: warning: nested flexible arrays
      1 net/nfc/nci/hci.c:53:8: warning: nested flexible arrays
      1 net/netfilter/nft_set_rbtree.c:25:8: warning: nested flexible arrays
      1 net/netfilter/nft_set_hash.c:417:8: warning: nested flexible arrays
      1 net/netfilter/nft_set_hash.c:29:8: warning: nested flexible arrays
      1 net/netfilter/nft_set_bitmap.c:15:8: warning: nested flexible arrays
      1 net/ipv4/esp4.c:26:8: warning: nested flexible arrays
      1 net/ipv4/ah4.c:18:8: warning: nested flexible arrays
      1 net/core/bpf_sk_storage.c:67:8: warning: nested flexible arrays
      1 net/ceph/auth_x_protocol.h:63:8: warning: nested flexible arrays
      1 net/bluetooth/rfcomm/tty.c:46:8: warning: nested flexible arrays
      1 net/bluetooth/mgmt_config.c:29:16: warning: nested flexible arrays
      1 net/bluetooth/l2cap_core.c:7985:16: warning: nested flexible arrays
      1 net/bluetooth/l2cap_core.c:5915:16: warning: nested flexible arrays
      1 net/bluetooth/l2cap_core.c:3930:16: warning: nested flexible arrays
      1 net/bluetooth/l2cap_core.c:1383:16: warning: nested flexible arrays
      1 net/bluetooth/l2cap_core.c:1382:8: warning: nested flexible arrays
      1 lib/crc-t10dif.c:65:16: warning: nested flexible arrays
      1 lib/bch.c:112:8: warning: nested flexible arrays
      1 kernel/events/core.c:7809:8: warning: nested flexible arrays
      1 kernel/bpf/bpf_struct_ops.c:29:8: warning: nested flexible arrays
      1 fs/ubifs/commit.c:497:8: warning: nested flexible arrays
      1 fs/ocfs2/xattr.c:53:8: warning: nested flexible arrays
      1 fs/jffs2/summary.h:140:7: warning: nested flexible arrays
      1 fs/dlm/user.c:58:16: warning: nested flexible arrays
      1 fs/dlm/user.c:52:8: warning: nested flexible arrays
      1 fs/dlm/requestqueue.c:18:8: warning: nested flexible arrays
      1 fs/dlm/midcomms.c:59:15: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:899:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:894:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:886:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:878:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:864:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:847:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:830:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:818:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:811:8: warning: nested flexible arrays
      1 fs/cifs/smb2pdu.h:805:8: warning: nested flexible arrays
      1 fs/btrfs/send.c:44:15: warning: nested flexible arrays
      1 fs/btrfs/send.c:43:8: warning: nested flexible arrays
      1 drivers/w1/w1_netlink.c:216:16: warning: nested flexible arrays
      1 drivers/w1/w1_netlink.c:195:16: warning: nested flexible arrays
      1 drivers/usb/host/xhci-dbgcap.h:100:8: warning: nested flexible arrays
      1 drivers/usb/host/oxu210hp-hcd.c:396:8: warning: nested flexible arrays
      1 drivers/usb/host/ehci-fsl.c:419:8: warning: nested flexible arrays
      1 drivers/usb/gadget/function/uvc_configfs.c:858:8: warning: nested flexible arrays
      1 drivers/usb/gadget/function/u_serial.c:98:8: warning: nested flexible arrays
      1 drivers/usb/class/cdc-acm.h:83:8: warning: nested flexible arrays
      1 drivers/tty/synclinkmp.c:151:16: warning: nested flexible arrays
      1 drivers/tty/synclink_gt.c:238:8: warning: nested flexible arrays
      1 drivers/tty/synclink.c:178:8: warning: nested flexible arrays
      1 drivers/tty/serial/kgdb_nmi.c:90:8: warning: nested flexible arrays
      1 drivers/tty/serial/ifx6x60.h:56:8: warning: nested flexible arrays
      1 drivers/tty/rocket_int.h:1127:8: warning: nested flexible arrays
      1 drivers/tty/nozomi.c:318:8: warning: nested flexible arrays
      1 drivers/tty/n_gsm.c:125:8: warning: nested flexible arrays
      1 drivers/tty/mxser.c:220:8: warning: nested flexible arrays
      1 drivers/tty/moxa.c:129:8: warning: nested flexible arrays
      1 drivers/tty/isicom.c:198:9: warning: nested flexible arrays
      1 drivers/tty/ipwireless/tty.c:46:8: warning: nested flexible arrays
      1 drivers/tty/goldfish.c:36:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192u/ieee80211/ieee80211.h:991:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192u/ieee80211/ieee80211.h:971:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192u/ieee80211/ieee80211.h:966:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192u/ieee80211/ieee80211.h:957:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:846:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:838:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:818:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:813:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:808:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtllib.h:799:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtl8192e/../rtllib.h:846:8: warning: nested flexible arrays
      1 drivers/staging/rtl8192e/rtl8192e/../rtllib.h:824:8: warning: nested flexible arrays
      1 drivers/staging/ks7010/ks_hostif.h:211:8: warning: nested flexible arrays
      1 drivers/staging/greybus/uart.c:43:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:99:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:95:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:90:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:84:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:78:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:71:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:129:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:125:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:121:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:117:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:112:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:108:8: warning: nested flexible arrays
      1 drivers/staging/greybus/audio_apbridgea.h:104:8: warning: nested flexible arrays
      1 drivers/staging/gdm724x/gdm_tty.h:25:8: warning: nested flexible arrays
      1 drivers/staging/fwserial/fwserial.h:238:8: warning: nested flexible arrays
      1 drivers/staging/comedi/drivers/jr3_pci.c:93:7: warning: nested flexible arrays
      1 drivers/scsi/qla2xxx/qla_tmpl.h:76:24: warning: nested flexible arrays
      1 drivers/scsi/qla2xxx/qla_tmpl.h:66:17: warning: nested flexible arrays
      1 drivers/scsi/pmcraid.h:658:8: warning: nested flexible arrays
      1 drivers/scsi/pmcraid.h:630:8: warning: nested flexible arrays
      1 drivers/scsi/pm8001/pm80xx_hwi.h:556:8: warning: nested flexible arrays
      1 drivers/scsi/pm8001/pm8001_hwi.h:337:8: warning: nested flexible arrays
      1 drivers/scsi/ipr.h:1465:8: warning: nested flexible arrays
      1 drivers/rpmsg/qcom_glink_native.c:911:16: warning: nested flexible arrays
      1 drivers/rpmsg/qcom_glink_native.c:790:16: warning: nested flexible arrays
      1 drivers/rpmsg/qcom_glink_native.c:48:8: warning: nested flexible arrays
      1 drivers/rpmsg/qcom_glink_native.c:408:16: warning: nested flexible arrays
      1 drivers/rpmsg/qcom_glink_native.c:1266:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:948:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:451:8: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:3237:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:2294:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:1930:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:1370:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:1117:16: warning: nested flexible arrays
      1 drivers/pci/controller/pci-hyperv.c:1028:16: warning: nested flexible arrays
      1 drivers/nvme/target/tcp.c:93:8: warning: nested flexible arrays
      1 drivers/nvme/target/tcp.c:55:8: warning: nested flexible arrays
      1 drivers/nvme/target/rdma.c:56:8: warning: nested flexible arrays
      1 drivers/nvme/target/loop.c:29:8: warning: nested flexible arrays
      1 drivers/nvme/target/loop.c:18:8: warning: nested flexible arrays
      1 drivers/nvme/target/fc.c:70:8: warning: nested flexible arrays
      1 drivers/nfc/pn533/usb.c:259:8: warning: nested flexible arrays
      1 drivers/nfc/pn533/usb.c:252:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:426:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:266:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:258:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:253:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:248:8: warning: nested flexible arrays
      1 drivers/net/wireless/wl3501.h:237:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/wl12xx_80211.h:133:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/scan.h:125:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:696:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:685:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:681:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:677:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:656:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:647:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:634:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:599:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:583:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:563:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:554:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:539:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:464:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:431:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:395:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:386:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:378:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:288:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:265:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:257:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/cmd.h:217:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:944:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:930:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:919:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:901:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:878:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:822:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:810:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:801:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:788:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:773:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:760:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:741:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:718:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:689:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:664:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:644:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:629:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:584:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:566:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:558:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:546:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:529:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:518:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:458:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:452:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:446:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:434:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:424:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:417:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:402:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:385:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:369:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:360:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:352:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:343:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:327:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:312:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:303:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:295:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:287:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:280:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:271:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:262:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:213:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:205:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:195:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:185:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:172:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:153:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wlcore/acx.h:115:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/scan.h:97:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/scan.h:34:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:63:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:55:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:48:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:40:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:34:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/cmd.h:14:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:73:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:48:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:382:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:373:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:349:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:344:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:335:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:307:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:294:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl18xx/acx.h:285:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/scan.h:67:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/scan.h:56:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/scan.h:110:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/scan.h:102:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:92:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:82:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:63:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:47:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:32:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/cmd.h:17:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/acx.h:29:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/../wlcore/scan.h:53:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl12xx/../wlcore/acx.h:474:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/wl12xx_80211.h:144:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/wl12xx_80211.h:136:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/wl12xx_80211.h:131:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/wl12xx_80211.h:108:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:96:9: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:377:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:328:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:312:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:300:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:280:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:271:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:234:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:216:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/cmd.h:138:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:89:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:848:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:832:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:817:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:809:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:790:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:783:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:776:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:769:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:762:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:752:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:711:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:697:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:683:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:555:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:510:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:49:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:496:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:485:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:431:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:402:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:381:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:359:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:342:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:330:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:314:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:301:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:267:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:176:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1292:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1235:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:122:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1224:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1201:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1180:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1145:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1137:8: warning: nested flexible arrays
      1 drivers/net/wireless/ti/wl1251/acx.h:1088:8: warning: nested flexible arrays
      1 drivers/net/wireless/rndis_wlan.c:209:15: warning: nested flexible arrays
      1 drivers/net/wireless/rndis_wlan.c:207:8: warning: nested flexible arrays
      1 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h:1405:8: warning: nested flexible arrays
      1 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h:1399:8: warning: nested flexible arrays
      1 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1680:8: warning: nested flexible arrays
      1 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1659:8: warning: nested flexible arrays
      1 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1620:8: warning: nested flexible arrays
      1 drivers/net/wireless/quantenna/qtnfmac/qlink.h:1608:8: warning: nested flexible arrays
      1 drivers/net/wireless/microchip/wilc1000/spi.c:50:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:4499:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:4213:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:4203:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:4067:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3957:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3862:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3782:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3753:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3668:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3644:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3603:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3561:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3530:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3499:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3414:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3385:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3355:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3316:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3280:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3208:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3139:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3051:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:3010:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2985:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2955:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2922:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2863:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2829:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2768:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2726:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2667:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2590:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2496:8: warning: nested flexible arrays
      1 drivers/net/wireless/marvell/mwl8k.c:2347:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlwifi/mvm/d3.c:1465:24: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlwifi/fw/dbg.h:83:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h:270:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlwifi/dvm/commands.h:2473:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlwifi/dvm/commands.h:2344:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlegacy/common.h:521:15: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlegacy/common.h:520:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlegacy/commands.h:2670:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlegacy/commands.h:2526:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/iwlegacy/commands.h:2482:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/libipw.h:469:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/libipw.h:442:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/libipw.h:434:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/libipw.h:420:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/libipw.h:403:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2200.h:690:15: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2200.h:688:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2200.h:505:15: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2200.h:503:8: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2100.h:786:15: warning: nested flexible arrays
      1 drivers/net/wireless/intel/ipw2x00/ipw2100.h:785:8: warning: nested flexible arrays
      1 drivers/net/wireless/ath/wil6210/wmi.c:4024:16: warning: nested flexible arrays
      1 drivers/net/wireless/ath/wil6210/wmi.c:2761:16: warning: nested flexible arrays
      1 drivers/net/wireless/ath/wil6210/main.c:467:16: warning: nested flexible arrays
      1 drivers/net/wireless/ath/wil6210/cfg80211.c:871:16: warning: nested flexible arrays
      1 drivers/net/wireless/ath/ath10k/htt.h:1791:8: warning: nested flexible arrays
      1 drivers/net/usb/hso.c:195:8: warning: nested flexible arrays
      1 drivers/net/ethernet/sfc/vfdi.h:162:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:91:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:86:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:77:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:69:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:63:8: warning: nested flexible arrays
      1 drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c:57:8: warning: nested flexible arrays
      1 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c:23:8: warning: nested flexible arrays
      1 drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c:133:8: warning: nested flexible arrays
      1 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h:75:8: warning: nested flexible arrays
      1 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h:246:15: warning: nested flexible arrays
      1 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h:244:8: warning: nested flexible arrays
      1 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:654:8: warning: nested flexible arrays
      1 drivers/mmc/host/vub300.c:296:8: warning: nested flexible arrays
      1 drivers/mmc/host/vub300.c:153:7: warning: nested flexible arrays
      1 drivers/mmc/core/sdio_uart.c:63:8: warning: nested flexible arrays
      1 drivers/media/usb/siano/smsusb.c:38:8: warning: nested flexible arrays
      1 drivers/md/raid5-ppl.c:135:8: warning: nested flexible arrays
      1 drivers/md/raid5-cache.c:82:8: warning: nested flexible arrays
      1 drivers/md/md-multipath.h:25:8: warning: nested flexible arrays
      1 drivers/md/dm-writecache.c:195:8: warning: nested flexible arrays
      1 drivers/md/dm-thin.c:229:8: warning: nested flexible arrays
      1 drivers/md/dm-clone-target.c:69:8: warning: nested flexible arrays
      1 drivers/md/bcache/writeback.c:761:8: warning: nested flexible arrays
      1 drivers/md/bcache/writeback.c:245:8: warning: nested flexible arrays
      1 drivers/md/bcache/super.c:481:9: warning: nested flexible arrays
      1 drivers/md/bcache/extents.c:427:33: warning: nested flexible arrays
      1 drivers/md/bcache/debug.c:159:8: warning: nested flexible arrays
      1 drivers/md/bcache/btree.c:340:9: warning: nested flexible arrays
      1 drivers/md/bcache/btree.c:2175:25: warning: nested flexible arrays
      1 drivers/md/bcache/btree.c:1089:9: warning: nested flexible arrays
      1 drivers/md/bcache/bset.c:1196:9: warning: nested flexible arrays
      1 drivers/md/bcache/alloc.c:621:9: warning: nested flexible arrays
      1 drivers/md/bcache/alloc.c:544:9: warning: nested flexible arrays
      1 drivers/md/bcache/alloc.c:540:8: warning: nested flexible arrays
      1 drivers/isdn/capi/capi.c:82:8: warning: nested flexible arrays
      1 drivers/ipack/devices/ipoctal.c:30:8: warning: nested flexible arrays
      1 drivers/input/keyboard/applespi.c:296:15: warning: nested flexible arrays
      1 drivers/input/keyboard/applespi.c:290:8: warning: nested flexible arrays
      1 drivers/infiniband/hw/mlx5/devx.c:42:8: warning: nested flexible arrays
      1 drivers/infiniband/hw/mlx5/devx.c:32:8: warning: nested flexible arrays
      1 drivers/infiniband/hw/hfi1/mad.c:63:8: warning: nested flexible arrays
      1 drivers/infiniband/hw/hfi1/firmware.c:149:8: warning: nested flexible arrays
      1 drivers/infiniband/core/uverbs_std_types_flow_action.c:218:8: warning: nested flexible arrays
      1 drivers/infiniband/core/cm.c:238:8: warning: nested flexible arrays
      1 drivers/hwspinlock/stm32_hwspinlock.c:23:8: warning: nested flexible arrays
      1 drivers/hwspinlock/sprd_hwspinlock.c:35:8: warning: nested flexible arrays
      1 drivers/hwspinlock/sirf_hwspinlock.c:21:8: warning: nested flexible arrays
      1 drivers/hv/vmbus_drv.c:1023:8: warning: nested flexible arrays
      1 drivers/gpu/drm/xlnx/zynqmp_disp.c:120:8: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:78:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:377:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:155:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c:109:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c:147:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c:136:23: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/engine/device/user.c:109:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:86:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:53:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:433:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:300:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:257:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c:168:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/client.c:76:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/client.c:71:8: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/client.c:194:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvkm/core/client.c:133:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/object.c:34:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/object.c:247:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/object.c:171:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/object.c:124:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/object.c:105:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/notify.c:67:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/notify.c:36:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/notify.c:148:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/notify.c:115:21: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/fifo.c:74:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/fifo.c:28:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nvif/client.c:66:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:76:21: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:35:8: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:300:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:268:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:129:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_usif.c:126:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_svm.c:625:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_nvif.c:77:21: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_chan.c:550:16: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/nouveau_abi16.c:370:15: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/dispnv50/disp.c:676:24: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/dispnv50/disp.c:675:25: warning: nested flexible arrays
      1 drivers/gpu/drm/nouveau/dispnv50/disp.c:646:16: warning: nested flexible arrays
      1 drivers/gpu/drm/i915/gvt/opregion.c:116:8: warning: nested flexible arrays
      1 drivers/gpu/drm/amd/amdgpu/si_dpm.h:958:8: warning: nested flexible arrays
      1 drivers/gpu/drm/amd/amdgpu/si_dpm.h:818:8: warning: nested flexible arrays
      1 drivers/crypto/sa2ul.h:326:8: warning: nested flexible arrays
      1 drivers/crypto/picoxcell_crypto.c:79:8: warning: nested flexible arrays
      1 drivers/crypto/padlock-sha.c:23:8: warning: nested flexible arrays
      1 drivers/crypto/marvell/octeontx/otx_cptvf_algs.h:165:8: warning: nested flexible arrays
      1 drivers/crypto/img-hash.c:82:8: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chtls/chtls_io.c:162:16: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chcr_ktls.h:67:8: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chcr_crypto.h:293:8: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chcr_core.h:172:8: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chcr_core.h:165:8: warning: nested flexible arrays
      1 drivers/crypto/chelsio/chcr_core.h:137:8: warning: nested flexible arrays
      1 drivers/crypto/atmel-aes.c:161:8: warning: nested flexible arrays
      1 drivers/crypto/amlogic/amlogic-gxl.h:109:8: warning: nested flexible arrays
      1 drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h:188:8: warning: nested flexible arrays
      1 drivers/clk/sifive/fu540-prci.c:145:8: warning: nested flexible arrays
      1 drivers/clk/samsung/clk-exynos5433.c:5499:8: warning: nested flexible arrays
      1 drivers/clk/clk-bm1880.c:62:8: warning: nested flexible arrays
      1 drivers/clk/bcm/clk-bcm63xx-gate.c:23:8: warning: nested flexible arrays
      1 drivers/clk/bcm/clk-bcm2835.c:313:8: warning: nested flexible arrays
      1 drivers/char/ttyprintk.c:20:8: warning: nested flexible arrays
      1 drivers/char/pcmcia/synclink_cs.c:137:16: warning: nested flexible arrays
      1 drivers/char/../tty/hvc/hvc_console.h:35:8: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:719:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:613:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:57:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:549:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:438:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:367:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:329:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:284:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:241:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:199:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:155:16: warning: nested flexible arrays
      1 drivers/acpi/nfit/intel.c:122:16: warning: nested flexible arrays
      1 crypto/xts.c:33:8: warning: nested flexible arrays
      1 crypto/lrw.c:52:8: warning: nested flexible arrays
      1 crypto/essiv.c:59:8: warning: nested flexible arrays
      1 crypto/cts.c:59:8: warning: nested flexible arrays
      1 crypto/cryptd.c:79:8: warning: nested flexible arrays
      1 crypto/chacha20poly1305.c:51:8: warning: nested flexible arrays
      1 crypto/chacha20poly1305.c:45:8: warning: nested flexible arrays
      1 crypto/chacha20poly1305.c:33:8: warning: nested flexible arrays
      1 crypto/algif_hash.c:19:8: warning: nested flexible arrays
      1 crypto/adiantum.c:76:8: warning: nested flexible arrays
      1 crypto/adiantum.c:120:16: warning: nested flexible arrays
      1 ./include/uapi/linux/wmi.h:40:8: warning: nested flexible arrays
      1 ./include/uapi/linux/sctp.h:633:7: warning: nested flexible arrays
      1 ./include/uapi/linux/fuse.h:817:8: warning: nested flexible arrays
      1 ./include/sound/sof/ext_manifest.h:82:8: warning: nested flexible arrays
      1 ./include/rdma/ib_verbs.h:2121:8: warning: nested flexible arrays
      1 ./include/net/tls.h:99:8: warning: nested flexible arrays
      1 ./include/net/netfilter/nf_conntrack_timeout.h:20:8: warning: nested flexible arrays
      1 ./include/linux/sctp.h:617:8: warning: nested flexible arrays
      1 ./include/linux/sctp.h:600:8: warning: nested flexible arrays
      1 ./include/linux/sctp.h:442:8: warning: nested flexible arrays
      1 ./include/linux/sctp.h:345:8: warning: nested flexible arrays
      1 ./include/linux/mlx5/mlx5_ifc.h:5049:8: warning: nested flexible arrays
      1 ./include/linux/mlx5/mlx5_ifc.h:4838:8: warning: nested flexible arrays
      1 ./include/linux/mlx5/mlx5_ifc.h:4683:8: warning: nested flexible arrays
      1 ./include/linux/mlx5/mlx5_ifc.h:4352:8: warning: nested flexible arrays
      1 ./include/linux/mlx5/mlx5_ifc.h:1980:8: warning: nested flexible arrays
      1 ./include/linux/greybus/greybus_protocols.h:2018:8: warning: nested flexible arrays
      1 ./include/linux/greybus/greybus_protocols.h:2002:15: warning: nested flexible arrays
      1 ./include/linux/greybus/greybus_protocols.h:1999:8: warning: nested flexible arrays
      1 ./include/linux/cyclades.h:119:8: warning: nested flexible arrays
      1 ./include/asm-generic/hyperv-tlfs.h:440:8: warning: nested flexible arrays
      1 ./include/asm-generic/hyperv-tlfs.h:434:15: warning: nested flexible arrays
      1 ./include/asm-generic/hyperv-tlfs.h:431:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tx.h:801:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tx.h:782:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tdls.h:184:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tdls.h:137:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tdls.h:121:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/tdls.h:109:8: warning: nested flexible arrays
      1 ./drivers/net/wireless/intel/iwlwifi/mvm/..//fw/api/scan.h:820:8: warning: nested flexible arrays

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding
  2020-10-01 19:41         ` Luc Van Oostenryck
@ 2020-10-01 19:51           ` Luc Van Oostenryck
  0 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2020-10-01 19:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Sparse Mailing-list

On Thu, Oct 01, 2020 at 09:41:21PM +0200, Luc Van Oostenryck wrote:
> On Thu, Oct 01, 2020 at 12:27:56PM -0700, Linus Torvalds wrote:
> > On Thu, Oct 1, 2020 at 12:17 PM Luc Van Oostenryck
> > <luc.vanoostenryck@gmail.com> wrote:
> > >
> > > > So in the kernel, we would
> > > >
> > > >  - start warning about 'sizeof(flex_struct)'
> > >
> > > Adding this warning by default annoys me slightly because it will
> > > add 5700+ warnings to the 18000 already present and I think sparse
> > > is already underused because it is very/too noisy. But I guess that
> > > most occurrences come from a few macros and thus should be easy to
> > > get rid off.
> > 
> > Hopefully. I'll try to take a look. Do you have the sparse changes in
> > a git branch already so that I can just try that directly?
> 
> What I posted yesterday is on
> 	git://git.kernel.org/pub/scm/devel/sparse/sparse-dev.git flex-array
> 
> > Or if you send me a couple of examples, maybe it's just the same
> > pattern over and over,..
> 
> Well, the 888 occurences I see are already 'unique' occurences
> (in the sense that the warning is from a distinct file+position).
> I'm adding in attachment the extract of my test logs (but it is
> on v5.9-rc1 so it's maybe not much usefull). I ddn't investigated
> anything, just checked a few case to see that it was a genuine
> occurrence.

Sorry, I was thinking about the nested ones and sent the wrong.
Here are the top entries for sizeof():
     66 ./include/linux/filter.h:752:16: warning: using sizeof on a flexible structure
     48 crypto/gcm.c:547:17: warning: using sizeof on a flexible structure
     48 crypto/authencesn.c:357:17: warning: using sizeof on a flexible structure
     48 crypto/authenc.c:339:17: warning: using sizeof on a flexible structure
     44 ./include/linux/ihex.h:26:38: warning: using sizeof on a flexible structure
     30 drivers/crypto/chelsio/chcr_algo.c:793:32: warning: using sizeof on a flexible structure
     29 ./include/crypto/skcipher.h:518:31: warning: using sizeof on a flexible structure
     27 ./include/linux/can/dev.h:100:13: warning: using sizeof on a flexible structure
     24 net/mac80211/tdls.c:874:32: warning: using sizeof on a flexible structure
     24 net/ipv6/ndisc.c:1662:18: warning: using sizeof on a flexible structure
     24 drivers/tty/tty_buffer.c:352:28: warning: using sizeof on a flexible structure
     24 drivers/tty/tty_buffer.c:316:28: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:972:25: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:968:32: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:961:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:905:25: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:897:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:760:49: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:756:55: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:747:62: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:738:49: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:729:53: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:577:33: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:559:39: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:554:41: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:404:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1134:33: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1118:55: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1114:51: warning: using sizeof on a flexible structure
     20 fs/proc/inode.c:110:9: warning: using sizeof on a flexible structure
     20 fs/proc/inode.c:109:17: warning: using sizeof on a flexible structure
     20 fs/proc/generic.c:425:29: warning: using sizeof on a flexible structure
     18 net/ipv4/tcp_output.c:1241:28: warning: using sizeof on a flexible structure
     18 net/core/net-sysfs.c:769:23: warning: using sizeof on a flexible structure
     17 ./include/linux/ihex.h:52:50: warning: using sizeof on a flexible structure
     16 fs/proc/inode.c:107:35: warning: using sizeof on a flexible structure
     16 ./include/crypto/skcipher.h:496:23: warning: using sizeof on a flexible structure
     15 mm/percpu.c:2259:21: warning: using sizeof on a flexible structure
     14 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h:281:27: warning: using sizeof on a flexible structure
     13 drivers/net/wireguard/messages.h:117:34: warning: using sizeof on a flexible structure
     13 ./include/crypto/hash.h:594:23: warning: using sizeof on a flexible structure
     12 net/netfilter/x_tables.c:780:21: warning: using sizeof on a flexible structure
     12 net/netfilter/x_tables.c:1157:21: warning: using sizeof on a flexible structure
     12 net/netfilter/ipset/ip_set_hash_gen.h:143:51: warning: using sizeof on a flexible structure
     12 net/netfilter/ipset/ip_set_hash_gen.h:139:29: warning: using sizeof on a flexible structure
     12 net/mac80211/iface.c:1829:28: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:6188:26: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:6146:39: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:4214:16: warning: using sizeof on a flexible structure
     12 net/core/bpf_sk_storage.c:666:32: warning: using sizeof on a flexible structure
     12 net/core/bpf_sk_storage.c:1081:9: warning: using sizeof on a flexible structure
     12 kernel/module.c:1601:19: warning: using sizeof on a flexible structure
     12 kernel/bpf/core.c:881:16: warning: using sizeof on a flexible structure
     12 drivers/staging/greybus/sdio.c:136:20: warning: using sizeof on a flexible structure
     12 drivers/infiniband/hw/cxgb4/provider.c:278:31: warning: using sizeof on a flexible structure
     12 drivers/gpu/drm/drm_managed.c:92:13: warning: using sizeof on a flexible structure
     12 drivers/crypto/picoxcell_crypto.c:711:17: warning: using sizeof on a flexible structure
     12 crypto/cmac.c:271:17: warning: using sizeof on a flexible structure
     12 crypto/cmac.c:266:17: warning: using sizeof on a flexible structure
     12 crypto/chacha20poly1305.c:528:17: warning: using sizeof on a flexible structure
     12 crypto/adiantum.c:429:23: warning: using sizeof on a flexible structure
     11 ./include/uapi/linux/bcache.h:101:17: warning: using sizeof on a flexible structure
     11 ./include/crypto/aead.h:414:23: warning: using sizeof on a flexible structure
     10 drivers/infiniband/sw/rxe/rxe.h:76:9: warning: using sizeof on a flexible structure
     10 drivers/base/devres.c:95:13: warning: using sizeof on a flexible structure
     10 ./include/rdma/rdmavt_qp.h:535:39: warning: using sizeof on a flexible structure
     10 ./include/rdma/ib_verbs.h:583:25: warning: using sizeof on a flexible structure
     10 ./include/crypto/hash.h:990:26: warning: using sizeof on a flexible structure
     10 ./include/crypto/akcipher.h:196:23: warning: using sizeof on a flexible structure

Less frequent ones removed. There is a lot with a single occurence
mostly in drivers/.


-- Luc


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-10-01 19:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 23:18 [PATCH 00/13] add warnings for flexible arrays Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 01/13] flex-array: add testcases Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 02/13] flex-array: factor out common part of lay_out_{struct,union}() Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 03/13] flex-array: do not lay out invalid struct members Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 04/13] flex-array: flexible array members have zero size and alignment is OK Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 05/13] flex-array: detect structures with a flexible array member Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 06/13] flex-array: warn on flexible arrays in unions Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 07/13] flex-array: warn if flexible array is not last Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 08/13] flex-array: identify structures with a flexible array member Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 09/13] flex-array: add helper has_flexible_array() Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 10/13] flex-array: warn when using sizeof() on a flexible array Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 11/13] flex-array: warn an arrays containing " Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 12/13] flex-array: warn on flexible array in nested aggregate types Luc Van Oostenryck
2020-09-30 23:18 ` [PATCH 13/13] flex-array: warn when a flexible array member has some padding Luc Van Oostenryck
2020-10-01 16:34   ` Linus Torvalds
2020-10-01 19:17     ` Luc Van Oostenryck
2020-10-01 19:27       ` Linus Torvalds
2020-10-01 19:41         ` Luc Van Oostenryck
2020-10-01 19:51           ` Luc Van Oostenryck
2020-10-01 16:36 ` [PATCH 00/13] add warnings for flexible arrays Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).