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]>
---
v2: Use str_to_uint() as suggested by Ilya.
---
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..dfe30d1d1 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);
+ unsigned int zone;
+ if (!str_to_uint(node->value, 10, &zone)) {
+ continue;
}
+
+ VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user);
+ bitmap_set1(ct_zone_bitmap, zone);
+ simap_put(ct_zones, user, zone);
}
}
--
2.27.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev