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

* Re: [PATCH] riscv: Fix range looking for kernel image memblock
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Anup Patel @ 2020-02-17  5:31 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: linux-kernel@vger.kernel.org List, stable, Jan Kiszka,
	Paul Walmsley, Palmer Dabbelt, linux-riscv

On Mon, Feb 17, 2020 at 10:59 AM Alexandre Ghiti <alex@ghiti.fr> wrote:
>
> 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
>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup


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

* Re: [PATCH] riscv: Fix range looking for kernel image memblock
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2020-03-04 23:16 UTC (permalink / raw)
  To: alex
  Cc: alex, anup, linux-kernel, stable, jan.kiszka, Paul Walmsley, linux-riscv

On Sun, 16 Feb 2020 21:28:47 PST (-0800), alex@ghiti.fr wrote:
> 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);
>
>  			/*

Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>

Thanks.  I'm going to target this for the next RC.


^ permalink raw reply	[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).