[PATCH] firmware: ti_sci: replace kcalloc with kzalloc for buffer pointer allocation
From: Siddharth Karanam
Date: Fri Sep 18 2026 - 08:11:13 EST
Previously, the buffer pointer was being allocated via devm_kcalloc that
would check for a mul overflow before allocating n * size bytes
(size being desc->max_msg_size), but since n is 1 here, we can instead
use devm_kzalloc that allocates the size directly.
Signed-off-by: Siddharth Karanam <sid9.karanam@xxxxxxxxx>
---
drivers/firmware/ti_sci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 33d7c4a4181e..8e346440e539 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -4132,7 +4132,7 @@ static int ti_sci_probe(struct platform_device *pdev)
/* Pre-initialize the buffer pointer to pre-allocated buffers */
for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
- xfer->xfer_buf = devm_kcalloc(dev, 1, desc->max_msg_size,
+ xfer->xfer_buf = devm_kzalloc(dev, desc->max_msg_size,
GFP_KERNEL);
if (!xfer->xfer_buf)
return -ENOMEM;
--
2.55.0