Skip to content

Commit 063ab16

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal: hisi: 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-5-lukasz.luba@arm.com [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e6c0525 commit 063ab16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/thermal/hisi_thermal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
412412

413413
data->nr_sensors = 1;
414414

415-
data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) *
416-
data->nr_sensors, GFP_KERNEL);
415+
data->sensor = devm_kcalloc(dev, data->nr_sensors,
416+
sizeof(*data->sensor), GFP_KERNEL);
417417
if (!data->sensor)
418418
return -ENOMEM;
419419

0 commit comments

Comments
 (0)