]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: atr: annotate i2c_atr_adap_desc->aliases with __counted_by_ptr
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 11 Jun 2026 21:55:02 +0000 (23:55 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 16 Jun 2026 22:15:09 +0000 (00:15 +0200)
Add the __counted_by_ptr() compiler attribute to ->aliases to improve
bounds checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260611215501.464405-3-thorsten.blum@linux.dev
include/linux/i2c-atr.h

index 2bb54dc87c8e561be766f259aee61d4ecc15efee..b52a7b9ec536207bf4b86c9c4d5670f98c2182cb 100644 (file)
@@ -71,7 +71,7 @@ struct i2c_atr_adap_desc {
        struct device *parent;
        struct fwnode_handle *bus_handle;
        size_t num_aliases;
-       u16 *aliases;
+       u16 *aliases __counted_by_ptr(num_aliases);
 };
 
 /**