Merge branch 'mlxsw-annotate-structs-with-__counted_by'
Kees Cook says: ==================== mlxsw: Annotate structs with __counted_by This annotates several mlxsw structures with the coming __counted_by attribute for bounds checking of flexible arrays at run-time. For more details, see commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro"). ==================== Link: https://lore.kernel.org/r/20230929180611.work.870-kees@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
af54c197a9
@ -624,7 +624,7 @@ struct mlxsw_linecards {
|
||||
struct mlxsw_linecard_types_info *types_info;
|
||||
struct list_head event_ops_list;
|
||||
struct mutex event_ops_list_lock; /* Locks accesses to event ops list */
|
||||
struct mlxsw_linecard linecards[];
|
||||
struct mlxsw_linecard linecards[] __counted_by(count);
|
||||
};
|
||||
|
||||
static inline struct mlxsw_linecard *
|
||||
|
@ -34,7 +34,7 @@ struct mlxsw_env {
|
||||
u8 num_of_slots; /* Including the main board. */
|
||||
u8 max_eeprom_len; /* Maximum module EEPROM transaction length. */
|
||||
struct mutex line_cards_lock; /* Protects line cards. */
|
||||
struct mlxsw_env_line_card *line_cards[];
|
||||
struct mlxsw_env_line_card *line_cards[] __counted_by(num_of_slots);
|
||||
};
|
||||
|
||||
static bool __mlxsw_env_linecard_is_active(struct mlxsw_env *mlxsw_env,
|
||||
|
@ -24,7 +24,7 @@ struct mlxsw_sp_counter_pool {
|
||||
spinlock_t counter_pool_lock; /* Protects counter pool allocations */
|
||||
atomic_t active_entries_count;
|
||||
unsigned int sub_pools_count;
|
||||
struct mlxsw_sp_counter_sub_pool sub_pools[];
|
||||
struct mlxsw_sp_counter_sub_pool sub_pools[] __counted_by(sub_pools_count);
|
||||
};
|
||||
|
||||
static const struct mlxsw_sp_counter_sub_pool mlxsw_sp_counter_sub_pools[] = {
|
||||
|
@ -3107,7 +3107,7 @@ struct mlxsw_sp_nexthop_group_info {
|
||||
gateway:1, /* routes using the group use a gateway */
|
||||
is_resilient:1;
|
||||
struct list_head list; /* member in nh_res_grp_list */
|
||||
struct mlxsw_sp_nexthop nexthops[];
|
||||
struct mlxsw_sp_nexthop nexthops[] __counted_by(count);
|
||||
};
|
||||
|
||||
static struct mlxsw_sp_rif *
|
||||
|
@ -31,7 +31,7 @@ struct mlxsw_sp_span {
|
||||
refcount_t policer_id_base_ref_count;
|
||||
atomic_t active_entries_count;
|
||||
int entries_count;
|
||||
struct mlxsw_sp_span_entry entries[];
|
||||
struct mlxsw_sp_span_entry entries[] __counted_by(entries_count);
|
||||
};
|
||||
|
||||
struct mlxsw_sp_span_analyzed_port {
|
||||
|
Loading…
x
Reference in New Issue
Block a user