Skip to content

Commit b1e0cdb

Browse files
keesGeorgi Djakov
authored andcommitted
interconnect: icc-clk: Annotate struct icc_clk_provider 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_clk_provider. [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 cb87901 commit b1e0cdb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/interconnect/icc-clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct icc_clk_node {
1616
struct icc_clk_provider {
1717
struct icc_provider provider;
1818
int num_clocks;
19-
struct icc_clk_node clocks[];
19+
struct icc_clk_node clocks[] __counted_by(num_clocks);
2020
};
2121

2222
#define to_icc_clk_provider(_provider) \

0 commit comments

Comments
 (0)