mirror of
https://github.com/torvalds/linux.git
synced 2026-11-28 01:13:11 +00:00
mxser: Annotate struct mxser_board with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct mxser_board. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Jiri Slaby <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Pengutronix Kernel Team <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: NXP Linux Team <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Jiri Slaby <[email protected]> Reviewed-by: "Gustavo A. R. Silva" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
500d179674
commit
f34907ecca
+1
-1
@@ -288,7 +288,7 @@ struct mxser_board {
|
||||
enum mxser_must_hwid must_hwid;
|
||||
speed_t max_baud;
|
||||
|
||||
struct mxser_port ports[];
|
||||
struct mxser_port ports[] __counted_by(nports);
|
||||
};
|
||||
|
||||
static DECLARE_BITMAP(mxser_boards, MXSER_BOARDS);
|
||||
|
||||
Reference in New Issue
Block a user