Types for UUID columns that are not references (e.g. version column)
may end up with the refType not initialized.  At the same time, some
functions use the value during the type comparison, which may result
in a false negative type check:

 WARNING: MemorySanitizer: use-of-uninitialized-value
  0 0x75abf7 in ovsdb_base_type_equals lib/ovsdb-types.c:321:16
  1 0x75f899 in ovsdb_type_equals lib/ovsdb-types.c:626:12
  2 0x4fc607 in ovsdb_convert_table ovsdb/file.c:316:13
  3 0x4fb5ec in ovsdb_convert ovsdb/file.c:388:17
  4 0x598bcf in ovsdb_trigger_try ovsdb/trigger.c:313:25
  5 0x596902 in ovsdb_trigger_init ovsdb/trigger.c:66:12
  6 0x5189e8 in ovsdb_jsonrpc_trigger_create ovsdb/jsonrpc-server.c:1247:27
  7 0x51473d in ovsdb_jsonrpc_session_got_request ovsdb/jsonrpc-server.c:1112:13
  8 0x512ea2 in ovsdb_jsonrpc_session_run ovsdb/jsonrpc-server.c:677:17
  9 0x50d67d in ovsdb_jsonrpc_session_run_all ovsdb/jsonrpc-server.c:700:21
 10 0x50cc49 in ovsdb_jsonrpc_server_run ovsdb/jsonrpc-server.c:522:9
 11 0x4d756f in main_loop ovsdb/ovsdb-server.c:330:9
 12 0x4c4e52 in main ovsdb/ovsdb-server.c:890:5
 13 0x7f42bb in __libc_start_call_main
 14 0x7f42bb in __libc_start_main@GLIBC_2.2.5
 15 0x432b64 in _start (ovsdb/ovsdb-server+0x432b64)

Fix the initialization function to always set the refType to some
value.  Using the "strong" as we don't have an UNSPEC value in the
enumeration.  It will not be meaningful unless the refTable is also
set, in which case it will be properly updated, we just need the
value to be the same for all the columns that are not references.

Fixes: e0e4266a90a2 ("ovsdb-types: Add functions to compare types for 
equality.")
Signed-off-by: Ilya Maximets <[email protected]>
---
 lib/ovsdb-types.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/ovsdb-types.c b/lib/ovsdb-types.c
index 197cee1c6..69f132597 100644
--- a/lib/ovsdb-types.c
+++ b/lib/ovsdb-types.c
@@ -145,6 +145,7 @@ ovsdb_base_type_init(struct ovsdb_base_type *base, enum 
ovsdb_atomic_type type)
     case OVSDB_TYPE_UUID:
         base->uuid.refTableName = NULL;
         base->uuid.refTable = NULL;
+        base->uuid.refType = OVSDB_REF_STRONG;
         break;
 
     case OVSDB_N_TYPES:
-- 
2.47.0

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

Reply via email to