Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lukasz Luba and committed by
Rafael J. Wysocki
83c34f50 c65b5c51

+2 -2
+2 -2
drivers/thermal/k3_j72xx_bandgap.c
··· 460 460 goto err_alloc; 461 461 } 462 462 463 - ref_table = kzalloc(sizeof(*ref_table) * TABLE_SIZE, GFP_KERNEL); 463 + ref_table = kcalloc(TABLE_SIZE, sizeof(*ref_table), GFP_KERNEL); 464 464 if (!ref_table) { 465 465 ret = -ENOMEM; 466 466 goto err_alloc; 467 467 } 468 468 469 - derived_table = devm_kzalloc(bgp->dev, sizeof(*derived_table) * TABLE_SIZE, 469 + derived_table = devm_kcalloc(bgp->dev, TABLE_SIZE, sizeof(*derived_table), 470 470 GFP_KERNEL); 471 471 if (!derived_table) { 472 472 ret = -ENOMEM;