Skip to content

Commit c40897f

Browse files
keesbroonie
authored andcommitted
spi: mchp-pci1xxxx: Annotate struct pci1xxxx_spi 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 pci1xxxx_spi. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Mark Brown <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 21f252c commit c40897f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-pci1xxxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct pci1xxxx_spi {
7777
struct pci_dev *dev;
7878
u8 total_hw_instances;
7979
void __iomem *reg_base;
80-
struct pci1xxxx_spi_internal *spi_int[];
80+
struct pci1xxxx_spi_internal *spi_int[] __counted_by(total_hw_instances);
8181
};
8282

8383
static const struct pci_device_id pci1xxxx_spi_pci_id_table[] = {

0 commit comments

Comments
 (0)