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>
This commit is contained in:
David Gibson 2018-03-09 13:38:15 +11:00
parent df536831d0
commit 02c5fe9deb

View file

@ -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 */ memset(buf, POISON, sizeof(buf)); /* poison the buffer */
len = fdt_get_path(fdt, offset, buf, buflen); 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 (buflen <= pathlen) {
if (len != -FDT_ERR_NOSPACE) if (len != -FDT_ERR_NOSPACE)