summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-03-23 12:13:39 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-04-04 07:56:22 +0000
commitd23affd41e85a96d144f2e684be4ad67266cb393 (patch)
treede5be5ca4b41d94c4f206b74cfa0d1270d276a79
parent3dce83dbc3cf1830053a03a2c0e00ae43da50b19 (diff)
downloadphosphor-mboxd-d23affd41e85a96d144f2e684be4ad67266cb393.zip
phosphor-mboxd-d23affd41e85a96d144f2e684be4ad67266cb393.tar.gz
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 <andrew@aj.id.au>
-rw-r--r--test/mbox.c4
1 files 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);
OpenPOWER on IntegriCloud