LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Hari Bathini <hbathini@linux.ibm.com>,
	Aditya Gupta <adityag@linux.ibm.com>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory
Date: Tue, 11 Aug 2026 12:35:50 +0530	[thread overview]
Message-ID: <f383ab65-3d65-4053-8340-b28082f751d8@linux.ibm.com> (raw)
In-Reply-To: <20260810145827.157972-3-thorsten.blum@linux.dev>



On 10/08/26 20:28, Thorsten Blum wrote:
> arch_check_excluded_range() checks if a kexec segment overlaps an
> excluded memory range.
>
> Both ranges use inclusive end addresses, but the overlap check uses
> exclusive comparisons. This skips ranges with start == ->ranges[i].end
> or end == ->ranges[i].start. Use inclusive comparisons instead.
>
> Fixes: 6e5250eaa665 ("powerpc/crash: use generic APIs to locate memory hole for kdump")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> Sashiko found this issue when reviewing another patch:
> https://sashiko.dev/#/patchset/20260809162403.18142-2-thorsten.blum%40linux.dev
> ---
>   arch/powerpc/kexec/file_load_64.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index 40b74cc4ed3e..32e2b7412a9f 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -58,7 +58,7 @@ int arch_check_excluded_range(struct kimage *image, unsigned long start,
>   
>   	emem = image->arch.exclude_ranges;
>   	for (i = 0; i < emem->nr_ranges; i++)
> -		if (start < emem->ranges[i].end && end > emem->ranges[i].start)
> +		if (start <= emem->ranges[i].end && end >= emem->ranges[i].start)

Like [1] this also extends the condition to check for a 1-byte overlap.
It is unlikely to occur in practice, but I don't see any harm in doing so.
Hence the changes looks good to me. Feel free to add.

Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com>

[1] 
https://lore.kernel.org/all/ee531113-5a56-4e6e-bc16-95941aa5bbfd@linux.ibm.com/

>   			return 1;
>   
>   	return 0;



      reply	other threads:[~2026-08-11  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 14:58 [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory Thorsten Blum
2026-08-11  7:05 ` Sourabh Jain [this message]

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=f383ab65-3d65-4053-8340-b28082f751d8@linux.ibm.com \
    --to=sourabhjain@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=chleroy@kernel.org \
    --cc=hbathini@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ruanjinjie@huawei.com \
    --cc=thorsten.blum@linux.dev \
    /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