diff --git a/tests/mangle-layout.supp b/tests/mangle-layout.supp deleted file mode 100644 index 2890420..0000000 --- a/tests/mangle-layout.supp +++ /dev/null @@ -1,7 +0,0 @@ -{ - uninitialized alignment gaps can be dumped to output - Memcheck:Param - write(buf) - obj:/lib/ld-*.so - fun:main -} diff --git a/tests/open_pack.supp b/tests/open_pack.supp deleted file mode 100644 index c954fe7..0000000 --- a/tests/open_pack.supp +++ /dev/null @@ -1,7 +0,0 @@ -{ - opened blob dumps uninitialized data - Memcheck:Param - write(buf) - obj:/lib/ld-*.so - fun:main -} diff --git a/tests/sw_tree1.supp b/tests/sw_tree1.supp deleted file mode 100644 index fcb1950..0000000 --- a/tests/sw_tree1.supp +++ /dev/null @@ -1,18 +0,0 @@ -{ - allocation methods causes uninitialized data in alignment gap - Memcheck:Param - write(buf) - fun:__write_nocancel - fun:utilfdt_write_err - fun:save_blob - fun:main -} -{ - allocation methods causes uninitialized data in alignment gap - Memcheck:Param - write(buf) - fun:write - fun:utilfdt_write_err - fun:save_blob - fun:main -} diff --git a/tests/testutils.c b/tests/testutils.c index 101b00b..d6d6818 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -30,6 +30,8 @@ #include #include +#include + #include #include "tests.h" @@ -179,11 +181,20 @@ void *load_blob_arg(int argc, char *argv[]) void save_blob(const char *filename, void *fdt) { - int ret = utilfdt_write_err(filename, fdt); + size_t size = fdt_totalsize(fdt); + void *tmp; + int ret; + /* Make a temp copy of the blob so that valgrind won't check + * about uninitialized bits in the pieces between blocks */ + tmp = xmalloc(size); + fdt_move(fdt, tmp, size); + VALGRIND_MAKE_MEM_DEFINED(tmp, size); + ret = utilfdt_write_err(filename, tmp); if (ret) CONFIG("Couldn't write blob to \"%s\": %s", filename, strerror(ret)); + free(tmp); } void *open_blob_rw(void *blob)