Hello Thorsten, +Cc Romain, author of the involved code +Cc Rosen, author of a similar patch elsewhere in i2c-atr [0]
[0] https://lore.kernel.org/linux-i2c/[email protected]/ On Mon Apr 27, 2026 at 7:28 PM CEST, Thorsten Blum wrote: > 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 <[email protected]> > --- > include/linux/i2c-atr.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/i2c-atr.h b/include/linux/i2c-atr.h > index 2bb54dc87c8e..b52a7b9ec536 100644 > --- a/include/linux/i2c-atr.h > +++ b/include/linux/i2c-atr.h > @@ -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); I'm not fully proficient about all counted_by things, but the patch looks OK to me, and definitely @num_aliases is the number of items @aliases must have, so: Reviewed-by: Luca Ceresoli <[email protected]> -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com

