All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Kees Cook <kees@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH] powerpc/smp: Handle of_property_count_u32_elems() error in parse_thread_groups()
Date: Tue, 10 Nov 2026 20:55:05 +0530	[thread overview]
Message-ID: <mrrg90a6.ritesh.list@gmail.com> (raw)
In-Reply-To: <20261109-powerpc-smp-handle-count-err-v1-1-e777fde7f71a@kernel.org>

Nathan Chancellor <nathan@kernel.org> writes:

> After commit 0af298e62e5c ("treewide: refresh kmalloc_obj()
> conversions"), there is a warning on boot for several PowerPC
> configurations in QEMU:
>
>   WARNING: mm/slub.c:5459 at ___kmalloc_large_node+0x174/0x1b0, CPU#0: swapper/0/1
>   Modules linked in:
>   CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.4.0-rc1-00262-g0af298e62e5c #1 PREEMPT(lazy)
>   NIP [c0000000006074e4] ___kmalloc_large_node+0x174/0x1b0
>   LR [c00000000060782c] __kmalloc_large_node_noprof+0x3c/0x150
>   Call Trace:
>   ...
>   [c00000000369fb60] [c000000000614ff0] __kmalloc_noprof+0x490/0x690
>   [c00000000369fbe0] [c000000000051308] _kzalloc_noprof.constprop.0+0x1c/0x74
>   [c00000000369fc00] [c00000000200b450] init_thread_group_cache_map+0xc0/0x2c4
>   ...
>
> In this case, of_property_count_u32_elems() returns -EINVAL because
> there is no "ibm,thread-groups" property. When kcalloc() was used to
> allocate thread_group_array, the multiplication overflow check in
> _kmalloc_array_noprof() caught that a really large allocation was
> requested (as -EINVAL was converted to size_t) and returned NULL.
> kzalloc_objs() has no such check, so the large allocation check in
> __kmalloc_large_noprof() triggers the visible warning above.
>
> Check if of_property_count_u32_elems() has returned an error and bail
> out if so, clearing up the warning.
>
> Fixes: 790a1662d3a2 ("powerpc/smp: Parse ibm,thread-groups with multiple properties")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  arch/powerpc/kernel/smp.c | 2 ++
>  1 file changed, 2 insertions(+)


Thanks for fixing it. Looks good to me. Please feel free to add:

Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

      parent reply	other threads:[~2026-11-10 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 18:00 [PATCH] powerpc/smp: Handle of_property_count_u32_elems() error in parse_thread_groups() Nathan Chancellor
2026-11-10  9:28 ` Shrikanth Hegde
2026-11-11  4:27   ` Nathan Chancellor
2026-11-10 15:25 ` Ritesh Harjani [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=mrrg90a6.ritesh.list@gmail.com \
    --to=ritesh.list@gmail.com \
    --cc=chleroy@kernel.org \
    --cc=kees@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=nathan@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=sshegde@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.