summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-04-21 11:15:00 -0700
committerAndes <uboot@andestech.com>2020-04-23 10:14:16 +0800
commitf614753c4b91bc3b56809773aeb17da10f1231a5 (patch)
tree73bfed5960b90d9a88b8b0b99fbfae2f75bb6015 /lib/fdtdec.c
parent5370478d1c7afb8b2a8a0a00b31ff97c3a2c0451 (diff)
fdtdec: Fix boundary check
In U-Boot, the reserved memory end address is considered as a inclusive address. This notion is followed while adding a reserved memory node to the DT. For example: end_address = start_address + size - 1 Follow the same notion and fix the end address computation while checking for existing nodes. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9ecfa2a2d7..460f0d250b 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1311,7 +1311,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
continue;
}
- if (addr == carveout->start && (addr + size) == carveout->end) {
+ if (addr == carveout->start && (addr + size - 1) ==
+ carveout->end) {
if (phandlep)
*phandlep = fdt_get_phandle(blob, node);
return 0;