blob: 7600e6fd9df40e1295362f6652fafb7db3908903 [file] [log] [blame]
From f7caae406df1e7edb93ea92ff9fb6d961e6937ca Mon Sep 17 00:00:00 2001
From: Alexandre Ghiti <alex@ghiti.fr>
Date: Mon, 17 Feb 2020 00:28:47 -0500
Subject: [PATCH] riscv: Fix range looking for kernel image memblock
commit a160eed4b783d7b250a32f7e5787c9867abc5686 upstream.
When looking for the memblock where the kernel lives, we should check
that the memory range associated to the memblock entirely comprises the
kernel image and not only intersects with it.
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 84747d7a1e85..0569138b4a4c 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -101,7 +101,7 @@ void __init setup_bootmem(void)
phys_addr_t vmlinux_end = __pa(_end);
phys_addr_t end = reg->base + reg->size;
- if (reg->base <= vmlinux_end && vmlinux_end <= end) {
+ if (reg->base <= vmlinux_start && vmlinux_end <= end) {
/*
* Reserve from the start of the region to the end of
* the kernel
--
2.7.4