On 2/5/25 17:03, Eelco Chaudron wrote:
> Ensure a valid meter is found before inserting it into the list.
> 
> Signed-off-by: Eelco Chaudron <echau...@redhat.com>
> ---
>  ofproto/ofproto.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 3df64efb9..dbea03c8f 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -6948,7 +6948,9 @@ meter_insert_rule(struct rule *rule)
>      uint32_t meter_id = ofpacts_get_meter(a->ofpacts, a->ofpacts_len);
>      struct meter *meter = ofproto_get_meter(rule->ofproto, meter_id);
>  
> -    ovs_list_insert(&meter->rules, &rule->meter_list_node);
> +    if (meter) {
> +        ovs_list_insert(&meter->rules, &rule->meter_list_node);
> +    }
>  }
>  
>  static void

I think, we should assert here instead.  The meter must exist at this point.
We do assert for a missing group in the caller function, so we should do the
same for meters.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to