diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2018-07-20 14:35:12 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-07-20 14:35:12 +1000 |
commit | 57f7f9e7bc7cbcf1eb4dc00692d0229c73057d69 (patch) | |
tree | 2c8c9b2b86e837b27ac05001617c8cfaa138eaa6 /tests | |
parent | c12b2b0c20eb8fbe1a22065f1d5f0f155ab56b0a (diff) | |
download | dtc-57f7f9e7bc7cbcf1eb4dc00692d0229c73057d69.zip dtc-57f7f9e7bc7cbcf1eb4dc00692d0229c73057d69.tar.gz dtc-57f7f9e7bc7cbcf1eb4dc00692d0229c73057d69.tar.bz2 |
tests: Don't call memcmp() with NULL arguments
You're not supposed to pass NULL to memcmp(), and some sanitizers complain
about it, even when the length is zero.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testutils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/testutils.c b/tests/testutils.c index 3c83b96..378869a 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -127,7 +127,7 @@ void check_property(void *fdt, int nodeoffset, const char *name, if (proplen != len) FAIL("Size mismatch on property \"%s\": %d insead of %d", name, proplen, len); - if (memcmp(val, prop->data, len) != 0) + if (len && memcmp(val, prop->data, len) != 0) FAIL("Data mismatch on property \"%s\"", name); } @@ -144,7 +144,7 @@ const void *check_getprop(void *fdt, int nodeoffset, const char *name, if (proplen != len) FAIL("Size mismatch on property \"%s\": %d insead of %d", name, proplen, len); - if (memcmp(val, propval, len) != 0) + if (len && memcmp(val, propval, len) != 0) FAIL("Data mismatch on property \"%s\"", name); return propval; |