[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250224173432.1946070-2-lukasz.luba@arm.com>
Date: Mon, 24 Feb 2025 17:33:03 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
rafael@...nel.org,
daniel.lezcano@...aro.org
Cc: lukasz.luba@....com,
rui.zhang@...el.com,
srinivas.pandruvada@...ux.intel.com
Subject: [PATCH 1/4] thermal: OF: Use kcalloc() instead of kzalloc() with multiplication
According to the latest recommendations, kcalloc() should be used instead
of kzalloc() with multiplication (which might overflow).
Switch to this new scheme and use more safe kcalloc().
No functional impact changes.
Signed-off-by: Lukasz Luba <lukasz.luba@....com>
---
drivers/thermal/thermal_of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 5ab4ce4daaebd..fb376bd4d9579 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -107,7 +107,7 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
if (!count)
return NULL;
- struct thermal_trip *tt __free(kfree) = kzalloc(sizeof(*tt) * count, GFP_KERNEL);
+ struct thermal_trip *tt __free(kfree) = kcalloc(count, sizeof(*tt), GFP_KERNEL);
if (!tt)
return ERR_PTR(-ENOMEM);
--
2.48.1
Powered by blists - more mailing lists