Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: qcom-pmic-typec: use kcalloc() instead of kzalloc()

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>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20250819090125.540682-1-rongqianfeng@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Qianfeng Rong and committed by
Greg Kroah-Hartman
1f43a340 956606ba

+2 -2
+1 -1
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
··· 567 567 if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS) 568 568 return -EINVAL; 569 569 570 - irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs, 570 + irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data), 571 571 GFP_KERNEL); 572 572 if (!irq_data) 573 573 return -ENOMEM;
+1 -1
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
··· 713 713 if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS) 714 714 return -EINVAL; 715 715 716 - irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs, 716 + irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data), 717 717 GFP_KERNEL); 718 718 if (!irq_data) 719 719 return -ENOMEM;