This commit adds non-null pointer assertions in some code that performs
some decisions based on old and new input ovsdb_rows.

Signed-off-by: James Raphael Tiovalen <jamestio...@gmail.com>
Reviewed-by: Simon Horman <simon.hor...@corigine.com>
---
 ovsdb/file.c    | 2 ++
 ovsdb/monitor.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ovsdb/file.c b/ovsdb/file.c
index 2d887e53e..b1d386e76 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -522,7 +522,9 @@ ovsdb_file_txn_add_row(struct ovsdb_file_txn *ftxn,
     }
 
     if (row) {
+        ovs_assert(new || old);
         struct ovsdb_table *table = new ? new->table : old->table;
+        ovs_assert(table);
         char uuid[UUID_LEN + 1];
 
         if (table != ftxn->table) {
diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
index 3cdd03b20..6965d4b4a 100644
--- a/ovsdb/monitor.c
+++ b/ovsdb/monitor.c
@@ -1332,8 +1332,10 @@ ovsdb_monitor_changes_update(const struct ovsdb_row *old,
                              const struct ovsdb_monitor_table *mt,
                              struct ovsdb_monitor_change_set_for_table *mcst)
 {
+    ovs_assert(new || old);
     const struct uuid *uuid = ovsdb_row_get_uuid(new ? new : old);
-    struct ovsdb_monitor_row *change;
+    ovs_assert(uuid);
+    struct ovsdb_monitor_row *change = NULL;
 
     change = ovsdb_monitor_changes_row_find(mcst, uuid);
     if (!change) {
-- 
2.40.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to