Unverified Commit 550bc517 authored by Qianfeng Rong's avatar Qianfeng Rong Committed by Mark Brown
Browse files

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: default avatarQianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: default avatarMatti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/20250817142327.174531-1-rongqianfeng@vivo.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6d068f1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1598,7 +1598,7 @@ static int setup_feedback_loop(struct device *dev, struct device_node *np,
		if (desc->n_linear_ranges && desc->linear_ranges) {
			struct linear_range *new;

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