summaryrefslogtreecommitdiff
path: root/net/openvswitch/meter.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-10-02 11:25:03 -0700
committerJakub Kicinski <kuba@kernel.org>2023-10-02 11:25:04 -0700
commit6d6e40ec48ca7195dceba681551dd92dc197b5a2 (patch)
treedf12ae00ddbab5330954ed7d433965f2dacecd74 /net/openvswitch/meter.h
parent436e5f758d6fbc2c5903d59f2cf9bb753ec77d9e (diff)
parent0d01cfe5aaafdff82df0381295620e58db29d0a8 (diff)
Merge branch 'batch-1-annotate-structs-with-__counted_by'
Kees Cook says: ==================== Batch 1: Annotate structs with __counted_by This is the batch 1 of patches touching netdev for preparing for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by to structs that would benefit from the annotation. Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.) [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci ==================== Link: https://lore.kernel.org/r/20230922172449.work.906-kees@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/openvswitch/meter.h')
-rw-r--r--net/openvswitch/meter.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/openvswitch/meter.h b/net/openvswitch/meter.h
index 0c33889a8515..ed11cd12b512 100644
--- a/net/openvswitch/meter.h
+++ b/net/openvswitch/meter.h
@@ -39,13 +39,13 @@ struct dp_meter {
u32 max_delta_t;
u64 used;
struct ovs_flow_stats stats;
- struct dp_meter_band bands[];
+ struct dp_meter_band bands[] __counted_by(n_bands);
};
struct dp_meter_instance {
struct rcu_head rcu;
u32 n_meters;
- struct dp_meter __rcu *dp_meters[];
+ struct dp_meter __rcu *dp_meters[] __counted_by(n_meters);
};
struct dp_meter_table {