From: Michal Simek <michal.simek@amd.com>
To: Qianfeng Rong <rongqianfeng@vivo.com>,
Linus Walleij <linus.walleij@linaro.org>,
"open list:PIN CONTROL SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"moderated list:ARM/ZYNQ ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] pinctrl: pinctrl-zynqmp: use kcalloc() instead of kzalloc()
Date: Wed, 20 Aug 2025 10:02:35 +0200 [thread overview]
Message-ID: <12eecfdd-5ce0-4893-ac1e-5d0ce53e4f98@amd.com> (raw)
In-Reply-To: <20250819143935.372084-3-rongqianfeng@vivo.com>
On 8/19/25 16:39, Qianfeng Rong wrote:
> Use devm_kcalloc() in versal_pinctrl_prepare_pin_desc() to gain built-in
> overflow protection, making memory allocation safer when calculating
> allocation size compared to explicit multiplication.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> drivers/pinctrl/pinctrl-zynqmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
> index 71eaac81deb1..aba129ead04c 100644
> --- a/drivers/pinctrl/pinctrl-zynqmp.c
> +++ b/drivers/pinctrl/pinctrl-zynqmp.c
> @@ -918,7 +918,7 @@ static int versal_pinctrl_prepare_pin_desc(struct device *dev,
> if (ret)
> return ret;
>
> - pins = devm_kzalloc(dev, sizeof(*pins) * *npins, GFP_KERNEL);
> + pins = devm_kcalloc(dev, *npins, sizeof(*pins), GFP_KERNEL);
> if (!pins)
> return -ENOMEM;
>
Acked-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
next prev parent reply other threads:[~2025-08-20 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 14:39 [PATCH 0/4] pinctrl: " Qianfeng Rong
2025-08-19 14:39 ` [PATCH 1/4] pinctrl: microchip-sgpio: " Qianfeng Rong
2025-08-19 14:39 ` [PATCH 2/4] pinctrl: pinctrl-zynqmp: " Qianfeng Rong
2025-08-20 8:02 ` Michal Simek [this message]
2025-08-19 14:39 ` [PATCH 3/4] pinctrl: qcom: sc8180x: " Qianfeng Rong
2025-08-19 18:37 ` Dmitry Baryshkov
2025-08-19 14:39 ` [PATCH 4/4] pinctrl: sunxi: " Qianfeng Rong
2025-08-20 13:17 ` Chen-Yu Tsai
2025-08-21 11:29 ` [PATCH 0/4] pinctrl: " Linus Walleij
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=12eecfdd-5ce0-4893-ac1e-5d0ce53e4f98@amd.com \
--to=michal.simek@amd.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rongqianfeng@vivo.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 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®