Skip to content

Commit 36b2d7d

Browse files
keesgregkh
authored andcommitted
driver core: platform: Annotate struct irq_affinity_devres 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 irq_affinity_devres. Cc: Greg Kroah-Hartman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: [email protected] Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] 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: Greg Kroah-Hartman <[email protected]>
1 parent eb7581d commit 36b2d7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ EXPORT_SYMBOL_GPL(platform_irq_count);
292292

293293
struct irq_affinity_devres {
294294
unsigned int count;
295-
unsigned int irq[];
295+
unsigned int irq[] __counted_by(count);
296296
};
297297

298298
static void platform_disable_acpi_irq(struct platform_device *pdev, int index)

0 commit comments

Comments
 (0)