Browse Source

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>
main
David Gibson 7 years ago
parent
commit
02c5fe9deb
  1. 3
      tests/get_path.c

3
tests/get_path.c

@ -42,7 +42,8 @@ static void check_path_buf(void *fdt, const char *path, int pathlen, int buflen) @@ -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)

Loading…
Cancel
Save