From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: John Ogness <john.ogness@linutronix.de>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Kees Cook <kees+treewide@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] powerpc/smp: parse_thread_groups() return error on missing property
Date: Sat, 14 Nov 2026 10:36:36 +0100 [thread overview]
Message-ID: <20261114093636.mDmlSOhU@linutronix.de> (raw)
In-Reply-To: <87mrrbrhf2.fsf@jogness.linutronix.de>
+ Kees, Vlastimil
On 2026-11-14 08:44:57 [+0106], John Ogness wrote:
> parse_thread_groups() is supposed to return -EINVAL if the property
> does not exist and -ENODATA if property does not have a value.
> However, it is currently assuming it exists and blindly calling
> kzalloc_objs() with whatever of_property_count_u32_elems() returns.
>
> Since of_property_count_u32_elems() returns exactly these same error
> values in those cases, simply return with the returned error value.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: 0af298e62e5cf ("treewide: refresh kmalloc_obj() conversions")
But… The difference in the commit was:
|- thread_group_array = kcalloc(count, sizeof(u32), GFP_KERNEL);
|+ thread_group_array = kzalloc_objs(u32, count);
| if (!thread_group_array)
| return -ENOMEM;
kcalloc() returned NULL on an overflow and did not continue with the
allocation. So the check below worked.
kzalloc_objs() on the other hand returns for the overflow SIZE_MAX and
passes this down to the allocator. We still get a NULL pointer but with
a warning (from ___kmalloc_large_node()).
Is the warning on purpose now?
Sebastian
prev parent reply other threads:[~2026-11-14 9:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 7:38 John Ogness
2026-11-14 9:36 ` Sebastian Andrzej Siewior [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=20261114093636.mDmlSOhU@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=chleroy@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=kees+treewide@kernel.org \
--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=ritesh.list@gmail.com \
--cc=sshegde@linux.ibm.com \
--cc=vbabka@suse.cz \
/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
all inboxes | Powered by JetHome®