From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Qianfeng Rong <rongqianfeng@vivo.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: qcom-pmic-typec: use kcalloc() instead of kzalloc()
Date: Tue, 19 Aug 2025 14:32:51 +0100 [thread overview]
Message-ID: <bee2fce1-facb-44c2-8eed-2bb396f9c204@linaro.org> (raw)
In-Reply-To: <20250819090125.540682-1-rongqianfeng@vivo.com>
On 19/08/2025 10:01, Qianfeng Rong wrote:
> Replace devm_kzalloc() with devm_kcalloc() in qcom_pmic_typec_pdphy_probe()
> and qcom_pmic_typec_port_probe() for safer memory allocation with built-in
> overflow protection.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 2 +-
> drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> index 18303b34594b..c8b1463e6e8b 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> @@ -567,7 +567,7 @@ int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
> if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS)
> return -EINVAL;
>
> - irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs,
> + irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data),
> GFP_KERNEL);
> if (!irq_data)
> return -ENOMEM;
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> index 4fc83dcfae64..8051eaa46991 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> @@ -713,7 +713,7 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
> if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS)
> return -EINVAL;
>
> - irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs,
> + irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data),
> GFP_KERNEL);
> if (!irq_data)
> return -ENOMEM;
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2025-08-19 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 9:01 [PATCH] usb: typec: qcom-pmic-typec: use kcalloc() instead of kzalloc() Qianfeng Rong
2025-08-19 11:47 ` Dmitry Baryshkov
2025-08-19 13:32 ` Bryan O'Donoghue [this message]
2025-08-21 7:21 ` Heikki Krogerus
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=bee2fce1-facb-44c2-8eed-2bb396f9c204@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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