From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Michael Turquette <mturquette@baylibre.com>,
Nishanth Menon <nm@ti.com>, Raag Jadav <raag.jadav@intel.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Stephen Boyd <sboyd@kernel.org>, Tero Kristo <kristo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] clk: keystone: sci-clk: use devm_kmemdup_array() once more in ti_sci_scan_clocks_from_fw()
Date: Fri, 31 Oct 2025 16:43:42 +0200 [thread overview]
Message-ID: <aQTLHlv2_V9Pgjk3@smile.fi.intel.com> (raw)
In-Reply-To: <a8e94921-a426-4db8-aed6-b6e17e88b8e3@web.de>
On Fri, Oct 31, 2025 at 03:33:24PM +0100, Markus Elfring wrote:
>
> * Reuse existing functionality from devm_kmemdup_array()
> instead of keeping duplicate source code.
>
> * Prevent a null pointer dereference.
>
>
> The source code was transformed by using the Coccinelle software.
>
> Fixes: 3c13933c60338ce6fb2369bd0e93f91e52ddc17d ("clk: keystone: sci-clk: add support for dynamically probing clocks")
Wrong format of Fixes tag, please keep the SHA at bare minumum.
...
> if (num_clks == max_clks) {
> - tmp_clks = devm_kmalloc_array(dev, max_clks + 64,
> - sizeof(sci_clk),
> - GFP_KERNEL);
> - memcpy(tmp_clks, clks, max_clks * sizeof(sci_clk));
> + tmp_clks = devm_kmemdup_array(dev, clks, max_clks + 64,
> + sizeof(sci_clk), GFP_KERNEL);
> if (max_clks)
> devm_kfree(dev, clks);
> + if (!tmp_clks)
> + return -ENOMEM;
You haven't read the code, right?
This now will work differently. Would it be acceptable?
> max_clks += 64;
> clks = tmp_clks;
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-10-31 14:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 14:33 [PATCH] clk: keystone: sci-clk: use devm_kmemdup_array() once more in ti_sci_scan_clocks_from_fw() Markus Elfring
2025-10-31 14:43 ` Andy Shevchenko [this message]
2025-10-31 15:06 ` Markus Elfring
2025-11-03 7:48 ` Andy Shevchenko
2025-11-03 8:05 ` Markus Elfring
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=aQTLHlv2_V9Pgjk3@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=kristo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=nm@ti.com \
--cc=raag.jadav@intel.com \
--cc=sboyd@kernel.org \
--cc=ssantosh@kernel.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 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.