Skip to content

Commit 6260ecd

Browse files
keesKAGA-KOKO
authored andcommitted
irqdomain: Annotate struct irq_domain 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 irq_domain. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bb80ec commit 6260ecd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/irqdomain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct irq_domain {
174174
irq_hw_number_t hwirq_max;
175175
unsigned int revmap_size;
176176
struct radix_tree_root revmap_tree;
177-
struct irq_data __rcu *revmap[];
177+
struct irq_data __rcu *revmap[] __counted_by(revmap_size);
178178
};
179179

180180
/* Irq domain flags */

0 commit comments

Comments
 (0)