On 5/18/22 18:09, Dumitru Ceara wrote:
> 0 is a valid zone ID and some CMSs might actually use it.
> 
> Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2087194
> Signed-off-by: Dumitru Ceara <[email protected]>
> ---
>  controller/ovn-controller.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index 0efe5c5ce..c2949fa30 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -825,13 +825,18 @@ restore_ct_zones(const struct ovsrec_bridge_table 
> *bridge_table,
>          }
>  
>          const char *user = node->key + 8;
> -        int zone = atoi(node->value);
> +        if (!user[0]) {
> +            continue;
> +        }
>  
> -        if (user[0] && zone) {
> -            VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user);
> -            bitmap_set1(ct_zone_bitmap, zone);
> -            simap_put(ct_zones, user, zone);
> +        int zone;
> +        if (!str_to_int(node->value, 10, &zone)) {

Maybe uint?  Negative values doesn't seem to be valid.

> +            continue;
>          }
> +
> +        VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user);
> +        bitmap_set1(ct_zone_bitmap, zone);
> +        simap_put(ct_zones, user, zone);
>      }
>  }
>  

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to