This change prevents returning an overflowing value by simply
returning zero in such cases. The return value is currently
unused in all its use cases.

Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/ovsdb-data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index abb923ad8..adb4714ee 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -1230,7 +1230,7 @@ ovsdb_datum_sort_unique(struct ovsdb_datum *datum,
         }
     }
     datum->n = dst;
-    return datum->n - src;
+    return datum->n > src ? datum->n - src : 0;
 }
 
 /* Checks that each of the atoms in 'datum' conforms to the constraints
-- 
2.46.0

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

Reply via email to