From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Sourabh Jain <sourabhjain@linux.ibm.com>,
Aditya Gupta <adityag@linux.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/kexec: Simplify kdump_extra_elfcorehdr_size()
Date: Thu, 30 Jul 2026 16:33:18 +0200 [thread overview]
Message-ID: <42ab7c21-25cd-4ed1-b43f-b155e82db1a0@kernel.org> (raw)
In-Reply-To: <20260730131940.597739-2-thorsten.blum@linux.dev>
Le 30/07/2026 à 15:19, Thorsten Blum a écrit :
> Return the size directly and drop the extra_sz variable to simplify
> kdump_extra_elfcorehdr_size(). The two warning paths now fall through
> to the existing return 0 at the end of the function.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> arch/powerpc/kexec/file_load_64.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index c3503d698428..d0c544079e03 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -377,16 +377,12 @@ static int load_backup_segment(struct kimage *image, struct kexec_buf *kbuf)
> static unsigned int kdump_extra_elfcorehdr_size(struct crash_mem *cmem)
> {
> #if defined(CONFIG_CRASH_HOTPLUG) && defined(CONFIG_MEMORY_HOTPLUG)
> - unsigned int extra_sz = 0;
> -
> if (CONFIG_CRASH_MAX_MEMORY_RANGES > (unsigned int)PN_XNUM)
> pr_warn("Number of Phdrs %u exceeds max\n", CONFIG_CRASH_MAX_MEMORY_RANGES);
> else if (cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES)
> pr_warn("Configured crash mem ranges may not be enough\n");
> else
> - extra_sz = (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr);
> -
> - return extra_sz;
> + return (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr);
I don't understand.
Previously, when cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES you
would return 0. Now you will return something different. For instance if
cmem->nr_ranges is (CONFIG_CRASH_MAX_MEMORY_RANGES + 1) you will return
(unsigned int)(-1 * sizeof(Elf64_Phdr))
> #endif
> return 0;
> }
next prev parent reply other threads:[~2026-07-30 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 13:19 [PATCH] powerpc/kexec: Simplify kdump_extra_elfcorehdr_size() Thorsten Blum
2026-07-30 14:33 ` Christophe Leroy (CS GROUP) [this message]
2026-07-30 14:45 ` Thorsten Blum
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=42ab7c21-25cd-4ed1-b43f-b155e82db1a0@kernel.org \
--to=chleroy@kernel.org \
--cc=adityag@linux.ibm.com \
--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=sourabhjain@linux.ibm.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