]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
riscv: Fix range looking for kernel image memblock
authorAlexandre Ghiti <alex@ghiti.fr>
Mon, 17 Feb 2020 05:28:47 +0000 (00:28 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 3 Apr 2020 13:17:23 +0000 (15:17 +0200)
BugLink: https://bugs.launchpad.net/bugs/1869061
[ Upstream commit a160eed4b783d7b250a32f7e5787c9867abc5686 ]

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: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
arch/riscv/mm/init.c

index 573463d1c799a0425e550681507643a9e60fe1cb..f5d813c1304da459220096d43e8ec052f9a66d0b 100644 (file)
@@ -98,7 +98,7 @@ void __init setup_bootmem(void)
        for_each_memblock(memory, reg) {
                phys_addr_t end = reg->base + reg->size;
 
-               if (reg->base <= vmlinux_end && vmlinux_end <= end) {
+               if (reg->base <= vmlinux_start && vmlinux_end <= end) {
                        mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET);
 
                        /*