diff options
author | Lukasz Luba <lukasz.luba@arm.com> | 2025-02-24 20:33:03 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-02-26 22:55:42 +0300 |
commit | c65b5c5187439ae940462c83d430204631045d06 (patch) | |
tree | be2a627ce0a01ef7b5cd7775ffa880ae58b477c1 | |
parent | e6ca59bb3c8f3fe00a9dc1ec72bcb77cd4ecd242 (diff) | |
download | linux-c65b5c5187439ae940462c83d430204631045d06.tar.xz |
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.
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20250224173432.1946070-2-lukasz.luba@arm.com
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/thermal/thermal_of.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 5ab4ce4daaeb..fb376bd4d957 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); |