diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2014-09-23 05:59:09 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-09-25 06:55:50 -0400 |
commit | 9aacd602f0246f1b1f3c4684b2ab13d0772976f7 (patch) | |
tree | 63b98dd512853323f19b82ec7a67fa2fd266cde1 /drivers/of/fdt.c | |
parent | 8f73d4b7011061f46ba6f46006b2848b412ff43f (diff) |
of/fdt: fix memory range check
In cases where board has below memory DT node
memory{
device_type = "memory";
reg = <0x80000000 0x80000000>;
};
Check on the memory range in fdt.c will always fail because it is
comparing MAX_PHYS_ADDR with base + size, in fact it should compare
it with base + size - 1.
This issue was originally noticed on Qualcomm IFC6410 board.
Without this patch kernel shows up noticed unnecessary warnings
[ 0.000000] Machine model: Qualcomm APQ8064/IFC6410
[ 0.000000] Ignoring memory range 0xffffffff - 0x100000000
[ 0.000000] cma: Reserved 64 MiB at ab800000
as a result the size get reduced to 0x7fffffff which looks wrong.
This patch fixes the check involved in generating this warning and
as a result it also fixes the wrong size calculation.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
[grant.likely: adjust new size calculation also]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 2d34afb2647d..d1ffca8b34ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -941,10 +941,10 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
941 | return; | 941 | return; |
942 | } | 942 | } |
943 | 943 | ||
944 | if (base + size > MAX_PHYS_ADDR) { | 944 | if (base + size - 1 > MAX_PHYS_ADDR) { |
945 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | 945 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
946 | ULONG_MAX, base + size); | 946 | ((u64)MAX_PHYS_ADDR) + 1, base + size); |
947 | size = MAX_PHYS_ADDR - base; | 947 | size = MAX_PHYS_ADDR - base + 1; |
948 | } | 948 | } |
949 | 949 | ||
950 | if (base + size < phys_offset) { | 950 | if (base + size < phys_offset) { |