From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: 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>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/kexec: Simplify kdump_extra_elfcorehdr_size()
Date: Fri, 31 Jul 2026 09:07:47 +0200 [thread overview]
Message-ID: <544be782-944e-4568-a2ac-4861680829a8@kernel.org> (raw)
In-Reply-To: <amtjkfZgkvFACYzE@linux.dev>
Le 30/07/2026 à 16:45, Thorsten Blum a écrit :
> On Thu, Jul 30, 2026 at 04:33:18PM +0200, Christophe Leroy (CS GROUP) wrote:
>> 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))
>
> It still returns 0.
>
> When cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES, the else if
> branch prints the warning and then falls through to the return 0 at the
> end of the function. The final else branch is not entered in that case.
Hum ... Yes sorry I missed that.
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
>
> No functional changes are intended.
>
>>> #endif
>>> return 0;
>>> }
>>
prev parent reply other threads:[~2026-07-31 7:07 UTC|newest]
Thread overview: 4+ 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)
2026-07-30 14:45 ` Thorsten Blum
2026-07-31 7:07 ` Christophe Leroy (CS GROUP) [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=544be782-944e-4568-a2ac-4861680829a8@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