While the long long is defined as minimal of 64 bit width, meaning
that it could change in the future to be wider e.g. 128. However, the
*_cfg columns are defined as int64_t so always begin 64 bits. Replace
the LLONG_MAX in potential overflow checks with INT64_MAX instead,
that will guarantee that even a change of long long width in the
future won't break this.

Signed-off-by: Ales Musil <[email protected]>
---
 ic/ovn-ic.c              | 2 +-
 tests/ovn-controller.at  | 4 ++--
 utilities/ovn-ic-nbctl.c | 2 +-
 utilities/ovn-nbctl.c    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 13e5534e7..801bd27e5 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -2707,7 +2707,7 @@ update_sequence_numbers(struct ic_context *ctx,
     if ((ic_nb->nb_ic_cfg != ic_sb->nb_ic_cfg) &&
                           (ic_nb->nb_ic_cfg != ctx->runned_az->nb_ic_cfg)) {
         /* Deal with potential overflows. */
-        if (ctx->runned_az->nb_ic_cfg == LLONG_MAX) {
+        if (ctx->runned_az->nb_ic_cfg == INT64_MAX) {
             icsbrec_availability_zone_set_nb_ic_cfg(ctx->runned_az, 0);
         }
         ic_sb_loop->next_cfg = ic_nb->nb_ic_cfg;
diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 6a7ffa5fe..b9dfcdc79 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -545,8 +545,8 @@ check ovn-nbctl --wait=hv sync
 # overflow the NB_Global nb_cfg value
 check ovn-nbctl set NB_Global . nb_cfg=9223372036854775806
 
-# nb_cfg must be set to zero if it exceed the value of LLONG_MAX
-# the command below will try incress the value of nb_cfg to be greater than 
LLONG_MAX and
+# nb_cfg must be set to zero if it exceed the value of INT64_MAX
+# the command below will try incress the value of nb_cfg to be greater than 
INT64_MAX and
 # expect zero as a return value
 check ovn-nbctl --wait=hv sync
 check ovn-nbctl --wait=hv sync
diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c
index 5819192fe..ed07e5902 100644
--- a/utilities/ovn-ic-nbctl.c
+++ b/utilities/ovn-ic-nbctl.c
@@ -830,7 +830,7 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, 
size_t n_commands,
     if (wait_type != NBCTL_WAIT_NONE) {
 
         /* Deal with potential overflows. */
-        if (inb->nb_ic_cfg == LLONG_MAX) {
+        if (inb->nb_ic_cfg == INT64_MAX) {
             icnbrec_ic_nb_global_set_nb_ic_cfg(inb, 0);
         }
         ovsdb_idl_txn_increment(txn, &inb->header_,
diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
index ab2ecc15b..058ad8968 100644
--- a/utilities/ovn-nbctl.c
+++ b/utilities/ovn-nbctl.c
@@ -95,7 +95,7 @@ nbctl_pre_execute(struct ovsdb_idl *idl, struct ovsdb_idl_txn 
*txn,
     }
 
     /* Deal with potential overflows. */
-    if (nb->nb_cfg == LLONG_MAX) {
+    if (nb->nb_cfg == INT64_MAX) {
         nbrec_nb_global_set_nb_cfg(nb, 0);
     }
 
-- 
2.51.0

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

Reply via email to