From d23affd41e85a96d144f2e684be4ad67266cb393 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Fri, 23 Mar 2018 12:13:39 +1030 Subject: test: mbox: LPC reserve memory size is not MTD size The backing file for the LPC reserved memory region was being allocated as the size of the MTD device. These sizes are completely unrelated. The current configuration causes segfaults when the reserved memory region exceeds the size of the flash. Instead, resize the backing file once we know how big it needs to be. Thankfully __init_lpc_dev() doesn't need the file to be sized to the reported reserved memory size. Change-Id: I89fd85ffe991ce0503055117684ac7d4d7b8abb1 Signed-off-by: Andrew Jeffery --- test/mbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mbox.c b/test/mbox.c index 6c62ddb..932c4d7 100644 --- a/test/mbox.c +++ b/test/mbox.c @@ -243,10 +243,10 @@ struct mbox_context *mbox_create_test_context(int n_windows, size_t len) rc = fallocate(test.flash.fd, 0, 0, test.context.mtd_info.size); assert(rc == 0); - rc = fallocate(test.lpc.fd, 0, 0, test.context.mtd_info.size); + rc = __init_lpc_dev(&test.context, test.lpc.path); assert(rc == 0); - rc = __init_lpc_dev(&test.context, test.lpc.path); + rc = fallocate(test.lpc.fd, 0, 0, test.context.mem_size); assert(rc == 0); rc = init_windows(&test.context); -- cgit v1.2.1