Skip to content

Commit

Permalink
db-ctl-base: Fix uninitialized datum fields while checking conditions.
Browse files Browse the repository at this point in the history
Statically allocated datum objects should be properly initialized with
a special function instead of doing that manually.

 WARNING: MemorySanitizer: use-of-uninitialized-value
  0 0x58789c in ovsdb_datum_compare_3way lib/ovsdb-data.c:1846:19
  1 0x52bbab in evaluate_relop lib/db-ctl-base.c:731:16
  2 0x52b042 in check_condition lib/db-ctl-base.c:844:22
  3 0x522fea in cmd_wait_until lib/db-ctl-base.c:1935:22
  4 0x4c704b in do_vsctl utilities/ovs-vsctl.c:3001:13
  5 0x4c4429 in main utilities/ovs-vsctl.c:204:17
  6 0x7f5ad5 in __libc_start_call_main
  7 0x7f5ad5 in __libc_start_main@GLIBC_2.2.5
  8 0x432b04 in _start (utilities/ovs-vsctl+0x432b04)

In this case the reference counter ended up not initialized.

Fixes: 485ac63 ("ovsdb: Add lazy-copy support for ovsdb_datum objects.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
igsilya committed Nov 28, 2024
1 parent 2af7cef commit e157664
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/db-ctl-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,10 @@ check_condition(const struct ovsdb_idl_table_class *table,
} else {
struct ovsdb_datum a;

ovsdb_datum_init_empty(&a);
if (found) {
a.n = 1;
a.keys = &have_datum->values[idx];
a.values = NULL;
} else {
a.n = 0;
a.keys = NULL;
a.values = NULL;
}

retval = evaluate_relop(&a, &b, &type, operator);
Expand Down

0 comments on commit e157664

Please sign in to comment.