* [PATCH] soc: qcom: use devm_kcalloc() for array space allocation
@ 2025-08-19 3:59 Qianfeng Rong
0 siblings, 0 replies; only message in thread
From: Qianfeng Rong @ 2025-08-19 3:59 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-kernel; +Cc: Qianfeng Rong
Replace calls of devm_kzalloc() with devm_kcalloc() in master_stats_probe()
for safer memory allocation with built-in overflow protection.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/soc/qcom/rpm_master_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c
index 49e4f9457279..c7788337e164 100644
--- a/drivers/soc/qcom/rpm_master_stats.c
+++ b/drivers/soc/qcom/rpm_master_stats.c
@@ -78,7 +78,7 @@ static int master_stats_probe(struct platform_device *pdev)
if (count < 0)
return count;
- data = devm_kzalloc(dev, count * sizeof(*data), GFP_KERNEL);
+ data = devm_kcalloc(dev, count, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-19 3:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 3:59 [PATCH] soc: qcom: use devm_kcalloc() for array space allocation Qianfeng Rong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).