Skip to content

Commit 6f0c60f

Browse files
keesGeorgi Djakov
authored andcommitted
interconnect: Annotate struct icc_path 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 icc_path. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Georgi Djakov <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent b1e0cdb commit 6f0c60f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/interconnect/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct icc_req {
3838
struct icc_path {
3939
const char *name;
4040
size_t num_nodes;
41-
struct icc_req reqs[];
41+
struct icc_req reqs[] __counted_by(num_nodes);
4242
};
4343

4444
#endif

0 commit comments

Comments
 (0)