[PATCH] x86/setup: Annotate pci_setup_rom::romdata with __counted_by()

From: Thorsten Blum

Date: Fri Sep 18 2026 - 08:16:04 EST


Add __counted_by() to pci_setup_rom::romdata to enable access bounds
checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
arch/x86/include/asm/setup_data.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/setup_data.h b/arch/x86/include/asm/setup_data.h
index 7bb16f843c93..36ca725182f9 100644
--- a/arch/x86/include/asm/setup_data.h
+++ b/arch/x86/include/asm/setup_data.h
@@ -15,7 +15,7 @@ struct pci_setup_rom {
unsigned long bus;
unsigned long device;
unsigned long function;
- uint8_t romdata[];
+ uint8_t romdata[] __counted_by(pcilen);
};

/* kexec external ABI */