Skip to contentSkip to conversation

x86/setup: Annotate pci_setup_rom::romdata with __counted_by()

PATCH New Thorsten Blum 1 participant 1 message Sep 18 x86

lore
Share & tools
lore
#0 lore raw

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

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

---
 arch/x86/include/asm/setup_data.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/setup_data.h +1 -1
index 7bb16f843c93..36ca725182f9 100644
@@ -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 */