summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-09-14 12:05:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-14 15:50:26 +0200
commit5fb2a0e8342424665a01d510ee64d742f586f877 (patch)
treebd8e3174b828f4da1168ac40a1bd10769ab96ffe /arch/sandbox/board
parent2ed55f746c4223b5d7dfcddb2aa3029dc8e7439b (diff)
downloadbarebox-5fb2a0e8342424665a01d510ee64d742f586f877.tar.gz
barebox-5fb2a0e8342424665a01d510ee64d742f586f877.tar.xz
sandbox: add_image: support mmaping block devices on 32-bit hosts
BLKGETSIZE64 writes 64-bit to the address pointed at by the ioctl argument. As hf->size is a 32-bit size_t on 32-bit systems, on such systems, the adjacent member might be corrupted. Fix this. Fixes: 8d6da6462b12 ("sandbox: add_image: mmap block devices") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/board')
-rw-r--r--arch/sandbox/board/dtb.c2
-rw-r--r--arch/sandbox/board/hostfile.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
index 74ecbadf42..d11bde0249 100644
--- a/arch/sandbox/board/dtb.c
+++ b/arch/sandbox/board/dtb.c
@@ -46,7 +46,7 @@ static int of_sandbox_init(void)
if (ret)
return ret;
- ret = of_property_write_u32(root, "#size-cells", 1);
+ ret = of_property_write_u32(root, "#size-cells", 2);
if (ret)
return ret;
}
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 56023b4ad4..07287fc0b4 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -134,6 +134,7 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
uint32_t reg[] = {
hf->base >> 32,
hf->base,
+ hf->size >> 32,
hf->size
};
int ret;