Skip to contentSkip to conversation

i2c: atr: annotate i2c_atr_adap_desc->aliases with __counted_by_ptr

PATCH RESEND In review Thorsten Blum 2 participants 2 messages Jun 11 – Jun 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 i2c: atr: annotate i2c_atr_adap_desc->aliases with __counted_by_ptr

Add the __counted_by_ptr() compiler attribute to ->aliases to improve bounds checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

---
 include/linux/i2c-atr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/i2c-atr.h +1 -1
index 2bb54dc87c8e..b52a7b9ec536 100644
@@ -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);
 };
 
 /**