summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board/hostfile.c
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/hostfile.c
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/hostfile.c')
-rw-r--r--arch/sandbox/board/hostfile.c1
1 files changed, 1 insertions, 0 deletions
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;