Patchwork [U-Boot,4/6] Fix off-by-one error in passing initrd end address via device tree

login
register
mail settings
Submitter Grant Likely
Date March 28, 2011, 7:58 p.m.
Message ID <20110328195854.10235.46139.stgit@ponder>
Download mbox | patch
Permalink /patch/88682/
State Accepted
Commit ce6b27a874fe30e7126ae93c060277770ee85ced
Delegated to: Jerry Van Baren
Headers show

Comments

Grant Likely - March 28, 2011, 7:58 p.m.
From: Grant Likely <grant.likely@linaro.org>

The initrd_end variable contains the address immediately *after* the
initrd blob, not the last address containing data.  This patch fixes
an inadvertent off-by-one when setting up the initrd reserved map.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
---
 common/fdt_support.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6c98e5b..1b5f9c8 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -183,7 +183,7 @@  int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 	}
 
-	err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start + 1);
+	err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start);
 	if (err < 0) {
 		printf("fdt_initrd: %s\n", fdt_strerror(err));
 		return err;