Skip to content

Commit 06919d2

Browse files
mm/memremap: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in struct dev_pagemap with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for a flexible-array member in a union. Also, this addresses multiple warnings reported when building with Clang-15 and -Wzero-length-array. Link: KSPP#193 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Gustavo A. R. Silva <[email protected]>
1 parent 37e2b57 commit 06919d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/memremap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct dev_pagemap {
135135
int nr_range;
136136
union {
137137
struct range range;
138-
struct range ranges[0];
138+
DECLARE_FLEX_ARRAY(struct range, ranges);
139139
};
140140
};
141141

0 commit comments

Comments
 (0)