Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <thecharlesjenkins@gmail.com>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH 3/6] riscv: remove unreachable invalid range check in create_linear_mapping_page_table()
Date: Sun, 21 Jun 2026 22:10:36 -0700	[thread overview]
Message-ID: <ajjDzE8WCzKI_w39@blinky> (raw)
In-Reply-To: <20260621145919.1453-4-ekffu200098@gmail.com>

On Sun, Jun 21, 2026 at 11:59:13PM +0900, Sang-Heon Jeon wrote:
> create_linear_mapping_page_table() iterates memblock regions with
> for_each_mem_range() and breaks the loop when start >= end.
> for_each_mem_range() never returns an invalid range, so start < end always.
> 
> Therefore the start >= end check is unreachable, so remove it.
> 
> No functional change.
> 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
Tested-by: Charlie Jenkins <thecharlesjenkins@gmail.com>

> ---
>  arch/riscv/mm/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 5b1b3c88b4d1..eb93c2ac05a6 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -1229,8 +1229,6 @@ static void __init create_linear_mapping_page_table(void)
>  
>  	/* Map all memory banks in the linear mapping */
>  	for_each_mem_range(i, &start, &end) {
> -		if (start >= end)
> -			break;
>  		if (start <= __pa(PAGE_OFFSET) &&
>  		    __pa(PAGE_OFFSET) < end)
>  			start = __pa(PAGE_OFFSET);
> -- 
> 2.43.0
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-06-22  5:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-21 14:59 [PATCH 0/6] treewide: remove unnecessary invalid range checks in memblock iteration loops Sang-Heon Jeon
2026-06-21 14:59 ` [PATCH 3/6] riscv: remove unreachable invalid range check in create_linear_mapping_page_table() Sang-Heon Jeon
2026-06-22  5:10   ` Charlie Jenkins [this message]
2026-06-21 14:59 ` [PATCH 4/6] riscv: remove unreachable invalid range check in kasan_init() Sang-Heon Jeon
2026-06-22  5:11   ` Charlie Jenkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajjDzE8WCzKI_w39@blinky \
    --to=thecharlesjenkins@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=ekffu200098@gmail.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox