Skip to content

Commit 550bc51

Browse files
qianfengrongbroonie
authored andcommitted
regulator: bd718x7: Use kcalloc() instead of kzalloc()
Replace calls of 'devm_kzalloc(dev, count * sizeof([type]), flags)' with 'devm_kcalloc(dev, count, sizeof([type]), flags)' in setup_feedback_loop() for safer memory allocation with built-in overflow protection. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/20250817142327.174531-1-rongqianfeng@vivo.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6d068f1 commit 550bc51

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/regulator/bd718x7-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ static int setup_feedback_loop(struct device *dev, struct device_node *np,
15981598
if (desc->n_linear_ranges && desc->linear_ranges) {
15991599
struct linear_range *new;
16001600

1601-
new = devm_kzalloc(dev, desc->n_linear_ranges *
1601+
new = devm_kcalloc(dev, desc->n_linear_ranges,
16021602
sizeof(struct linear_range),
16031603
GFP_KERNEL);
16041604
if (!new)

0 commit comments

Comments
 (0)