Commit f8e5b778 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'chelsio-annotate-structs-with-__counted_by'

Kees Cook says:

====================
chelsio: Annotate structs with __counted_by

This annotates several chelsio structures with the coming __counted_by
attribute for bounds checking of flexible arrays at run-time. For more details,
see commit dd06e72e ("Compiler Attributes: Add __counted_by macro").
====================

Link: https://lore.kernel.org/r/20230929181042.work.990-kees@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 07cf7974 1508cb7e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ struct l2t_data {
	atomic_t nfree;		/* number of free entries */
	rwlock_t lock;
	struct rcu_head rcu_head;	/* to handle rcu cleanup */
	struct l2t_entry l2tab[];
	struct l2t_entry l2tab[] __counted_by(nentries);
};

typedef void (*arp_failure_handler_func)(struct t3cdev * dev,
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct clip_tbl {
	atomic_t nfree;
	struct list_head ce_free_head;
	void *cl_list;
	struct list_head hash_list[];
	struct list_head hash_list[] __counted_by(clipt_size);
};

enum {
+1 −1
Original line number Diff line number Diff line
@@ -331,6 +331,6 @@ struct cxgb4_link {

struct cxgb4_tc_u32_table {
	unsigned int size;          /* number of entries in table */
	struct cxgb4_link table[]; /* Jump table */
	struct cxgb4_link table[] __counted_by(size); /* Jump table */
};
#endif /* __CXGB4_TC_U32_PARSE_H */
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ struct l2t_data {
	rwlock_t lock;
	atomic_t nfree;             /* number of free entries */
	struct l2t_entry *rover;    /* starting point for next allocation */
	struct l2t_entry l2tab[];  /* MUST BE LAST */
	struct l2t_entry l2tab[] __counted_by(l2t_size);  /* MUST BE LAST */
};

static inline unsigned int vlan_prio(const struct l2t_entry *e)
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ struct sched_class {

struct sched_table {      /* per port scheduling table */
	u8 sched_size;
	struct sched_class tab[];
	struct sched_class tab[] __counted_by(sched_size);
};

static inline bool can_sched(struct net_device *dev)
Loading