Skip to content

Commit 997a29b

Browse files
keesBartosz Golaszewski
authored andcommitted
eeprom: at24: Annotate struct at24_data 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 at24_data. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 4cdc5db commit 997a29b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/eeprom/at24.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct at24_data {
9292
* them for us.
9393
*/
9494
u8 bank_addr_shift;
95-
struct regmap *client_regmaps[];
95+
struct regmap *client_regmaps[] __counted_by(num_addresses);
9696
};
9797

9898
/*

0 commit comments

Comments
 (0)