From: Lee Jones <lee@kernel.org>
To: Sasha Levin <sashal@kernel.org>, Mark Brown <broonie@kernel.org>
Cc: Mark Brown <broonie@kernel.org>, Pavel Machek <pavel@kernel.org>,
Kees Cook <kees@kernel.org>, Wentao Liang <vulab@iscas.ac.cn>,
linux-leds@vger.kernel.org,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH linux-next] leds: netxbig: drop the second allocation of the leds array
Date: Wed, 2 Dec 2026 09:25:02 +0000 [thread overview]
Message-ID: <20261202092502.GQ90630@joneslee-mac.roam.internal> (raw)
In-Reply-To: <20261201155641.717600-1-sashal@kernel.org>
FAO Mark,
> Since next-20261120 the merge of the leds-lj tree with the origin tree
> allocates the leds array in netxbig_leds_get_of_pdata() twice:
>
> leds = devm_kzalloc_objs(dev, *leds, num_leds);
> leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
> if (!leds)
> return -ENOMEM;
>
> The first line is the origin side, from commit 4dd10fbbeb9c ("treewide:
> Convert devm_kmalloc() family to the devm_kmalloc_obj() family"). The
> second is the leds-lj side: commit 41ea2c75f886 ("leds: netxbig: Fix
> platform device reference leak on successful probe") only changed the
> error path below it. The first array is never used and stays allocated
> until the device is unbound.
>
> Keep the devm_kzalloc_objs() call and drop the devm_kcalloc() one, as
> the merge does for the other allocations in this function.
>
> Fixes: 7fa58f4b0c86 ("Merge branch 'for-leds-next' of https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git")
> Link: https://lore.kernel.org/all/c05653b5-c8bd-46ca-aaf5-281e8d74f1e6@sirena.org.uk/
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> For folding into the leds-lj merge. Applies to next-20261130, built
> drivers/leds/leds-netxbig.o on x86_64 allmodconfig (clang 21, W=1).
I think this was Mark's -next patch.
> drivers/leds/leds-netxbig.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
> index 29ddebebfa37d..284f3bfad9cbe 100644
> --- a/drivers/leds/leds-netxbig.c
> +++ b/drivers/leds/leds-netxbig.c
> @@ -510,7 +510,6 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
> }
>
> leds = devm_kzalloc_objs(dev, *leds, num_leds);
> - leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
> if (!leds)
> return -ENOMEM;
>
>
> base-commit: 253f86660c1f882fbf554db5eaa34bc5d66dc7e8
> --
> 2.53.0
>
--
Lee Jones
prev parent reply other threads:[~2026-12-02 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 15:56 Sasha Levin
2026-12-02 9:25 ` Lee Jones [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=20261202092502.GQ90630@joneslee-mac.roam.internal \
--to=lee@kernel.org \
--cc=broonie@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=sashal@kernel.org \
--cc=vulab@iscas.ac.cn \
/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®