From: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
To: Shuah Khan <skhan@linuxfoundation.org>, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, david.hunter.linux@gmail.com,
linux-kernel-mentees@lists.linuxfoundation.org,
khalid@kernel.org
Subject: Re: [PATCH] lib: cpu_rmap.c Refactor allocation size calculation in kzalloc()
Date: Thu, 9 Oct 2025 16:16:27 +0100 [thread overview]
Message-ID: <84bf5902-b3e5-4d58-a2a7-f01e15cfe143@gmail.com> (raw)
In-Reply-To: <10082c41-4302-4cb3-a2bf-788e59bad0c8@linuxfoundation.org>
On 10/7/25 11:23 PM, Shuah Khan wrote:
>
> How did you find this problem and how did you test this change?
For the first part of your question,After simply referring to deprecated
documentation[1] which states the following:
'For other calculations, please compose the use of the size_mul(),
size_add(), and size_sub() helpers'
Which is about dynamic calculations made inside of kzalloc() and
kmalloc(). Specifically, the quoted part is talking about calculations
which can't be simply divided into two parameters referring to the
number of elements and size per element and in cases where we can't use
struct_size() too.After that it was a matter of finding code where that
could be the problem which is the case of the changed code.
For the second part, As per any patch,I make a copy of all dmesg
warnings errors critical messages,then I compile install and boot the
new kernel then check if there is any change or regression in dmesg.
For this particular change, since it doesn't have any selftests because
it's in utility library which in my case cpu_rmap is used in the
networking subsystem, I did some fault injection with a custom module to
test if in case of overflow it fails safely reporting the issue in dmesg
which is catched by the __alloc_frozen_pages_noprof() function in
mm/page_alloc.c and also return a NULL for rmap instead of wrapping to a
smaller size.
If any further testing or work to be done or even suggestions on
improvements to my testing methodology, I would gladly hear any advice.
Thank you for you time.
>
> thanks,
> -- Shuah
Best Regards,
Mehdi Ben Hadj Khelifa
next prev parent reply other threads:[~2025-10-09 14:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 9:23 [PATCH] lib: cpu_rmap.c Refactor allocation size calculation in kzalloc() Mehdi Ben Hadj Khelifa
2025-10-07 22:23 ` Shuah Khan
2025-10-09 15:16 ` Mehdi Ben Hadj Khelifa [this message]
2025-10-10 17:00 ` Shuah Khan
2025-10-18 16:52 ` Mehdi Ben Hadj Khelifa
2025-10-20 20:36 ` Shuah Khan
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=84bf5902-b3e5-4d58-a2a7-f01e15cfe143@gmail.com \
--to=mehdi.benhadjkhelifa@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david.hunter.linux@gmail.com \
--cc=khalid@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.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