linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: Fix range looking for kernel image memblock
@ 2020-02-17  5:28 Alexandre Ghiti
  2020-02-17  5:31 ` Anup Patel
  2020-03-04 23:16 ` Palmer Dabbelt
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Ghiti @ 2020-02-17  5:28 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt
  Cc: Alexandre Ghiti, Anup Patel, linux-kernel, stable, Jan Kiszka,
	linux-riscv

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>
---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 965a8cf4829c..fab855963c73 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -131,7 +131,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);
 
 			/*
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-04 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17  5:28 [PATCH] riscv: Fix range looking for kernel image memblock Alexandre Ghiti
2020-02-17  5:31 ` Anup Patel
2020-03-04 23:16 ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).