diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2018-03-09 13:38:15 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-03-09 14:01:48 +1100 |
commit | 02c5fe9debc0e31e97ee0f158627d5cb512c7940 (patch) | |
tree | 0874cadebd2fa161c1021a4a3c1f2fc2050317d3 | |
parent | df536831d02c51556a8e88cd8da0be0244484156 (diff) | |
download | device-tree-compiler-02c5fe9debc0e31e97ee0f158627d5cb512c7940.tar.gz |
tests: Remove valgrind error from tests/get_path
In the case where fdt_get_path() returns an error, a debug print will
attempt to display a poisoned buffer, running over the end and accessing
uninitialized memory.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | tests/get_path.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/get_path.c b/tests/get_path.c index 7352976..7701dba 100644 --- a/tests/get_path.c +++ b/tests/get_path.c @@ -42,7 +42,8 @@ static void check_path_buf(void *fdt, const char *path, int pathlen, int buflen) memset(buf, POISON, sizeof(buf)); /* poison the buffer */ len = fdt_get_path(fdt, offset, buf, buflen); - verbose_printf("get_path() %s -> %d -> %s\n", path, offset, buf); + verbose_printf("get_path() %s -> %d -> %s\n", path, offset, + len >= 0 ? buf : "<error>"); if (buflen <= pathlen) { if (len != -FDT_ERR_NOSPACE) |