Skip to content

Commit 83c34f5

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal: k3_j72xx_bandgap: Use kcalloc() instead of kzalloc()
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-3-lukasz.luba@arm.com [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c65b5c5 commit 83c34f5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/thermal/k3_j72xx_bandgap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,13 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
460460
goto err_alloc;
461461
}
462462

463-
ref_table = kzalloc(sizeof(*ref_table) * TABLE_SIZE, GFP_KERNEL);
463+
ref_table = kcalloc(TABLE_SIZE, sizeof(*ref_table), GFP_KERNEL);
464464
if (!ref_table) {
465465
ret = -ENOMEM;
466466
goto err_alloc;
467467
}
468468

469-
derived_table = devm_kzalloc(bgp->dev, sizeof(*derived_table) * TABLE_SIZE,
469+
derived_table = devm_kcalloc(bgp->dev, TABLE_SIZE, sizeof(*derived_table),
470470
GFP_KERNEL);
471471
if (!derived_table) {
472472
ret = -ENOMEM;

0 commit comments

Comments
 (0)