Skip to content

Commit 787650c

Browse files
keesdtor
authored andcommitted
Input: Annotate struct ff_device 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 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 ff_device. 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: Dmitry Torokhov <[email protected]>
1 parent 68ede28 commit 787650c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ struct ff_device {
562562

563563
int max_effects;
564564
struct ff_effect *effects;
565-
struct file *effect_owners[];
565+
struct file *effect_owners[] __counted_by(max_effects);
566566
};
567567

568568
int input_ff_create(struct input_dev *dev, unsigned int max_effects);

0 commit comments

Comments
 (0)