Skip to content

Commit 2e89345

Browse files
keesrafaeljw
authored andcommitted
ACPI: PRM: Annotate struct prm_module_info 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 prm_module_info. 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]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 8a749fd commit 2e89345

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/prmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct prm_module_info {
6969
bool updatable;
7070

7171
struct list_head module_list;
72-
struct prm_handler_info handlers[];
72+
struct prm_handler_info handlers[] __counted_by(handler_count);
7373
};
7474

7575
static u64 efi_pa_va_lookup(u64 pa)

0 commit comments

Comments
 (0)