summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-24 08:52:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-01 08:18:53 +0200
commit5f03074ea98b64b55c133b35ee144fdc909e6d69 (patch)
tree1a61fd84a5a44d98297014486eca663221ff4cbc /arch/arm/lib/bootm.c
parent20addb80f65076b3a81c7d778f7b93d445a96841 (diff)
downloadbarebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.gz
barebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.xz
resource: store 'end' instead of 'size' in struct resource
Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/bootm.c')
-rw-r--r--arch/arm/lib/bootm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 033e2eb15b..3a00437069 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -80,7 +80,7 @@ static int __do_bootm_linux(struct image_data *data, int swap)
if (data->initrd_res) {
initrd_start = data->initrd_res->start;
- initrd_size = data->initrd_res->size;
+ initrd_size = resource_size(data->initrd_res);
}
if (bootm_verbose(data)) {
@@ -154,7 +154,7 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
}
} else {
- of_res = request_sdram_region("oftree", r->start + r->size, end);
+ of_res = request_sdram_region("oftree", r->start + resource_size(r), end);
if (!of_res) {
perror("zImage: oftree request_sdram_region");
return -ENOMEM;
@@ -310,9 +310,9 @@ static int aimage_load_resource(int fd, struct resource *r, void* buf, int ps)
{
int ret;
void *image = (void *)r->start;
- unsigned to_read = ps - r->size % ps;
+ unsigned to_read = ps - resource_size(r) % ps;
- ret = read_full(fd, image, r->size);
+ ret = read_full(fd, image, resource_size(r));
if (ret < 0)
return ret;