From 2dfc2a22a26b8726b1da336e952c3d05ebe02aed Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Thu, 14 Mar 2019 16:42:15 +1030 Subject: test/flash_copy: Configure MTD device to avoid undefined behaviour Otherwise we observe invalid memory accesses due to uninitialised variables. Change-Id: I8b9063ccc9a25b225a562ebe120f2a99a28788ca Signed-off-by: Andrew Jeffery --- test/Makefile.am.include | 3 ++- test/flash_copy.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Makefile.am.include b/test/Makefile.am.include index 845c13a..de1bfce 100644 --- a/test/Makefile.am.include +++ b/test/Makefile.am.include @@ -4,7 +4,8 @@ test_flash_copy_SOURCES = \ %reldir%/flash_copy.c \ flash.c \ common.c mtd.c \ - %reldir%/tmpf.c + %reldir%/tmpf.c \ + %reldir%/system.c test_flash_erase_SOURCES = \ %reldir%/flash_erase.c \ diff --git a/test/flash_copy.c b/test/flash_copy.c index 08dfc1a..3b88b76 100644 --- a/test/flash_copy.c +++ b/test/flash_copy.c @@ -13,6 +13,7 @@ #include "mboxd.h" #include "flash.h" +#include "test/system.h" #include "test/tmpf.h" #define TEST_SIZE 4096 @@ -26,7 +27,7 @@ void cleanup(void) int main(void) { - struct mbox_context context; + struct mbox_context context = {0}; ssize_t processed; int rand_fd; char *src; @@ -35,6 +36,8 @@ int main(void) atexit(cleanup); + system_set_mtd_sizes(TEST_SIZE, TEST_SIZE); + mbox_vlog = &mbox_log_console; src = malloc(TEST_SIZE); -- cgit v1.2.1