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>
This commit is contained in:
Qianfeng Rong 2025-08-17 22:23:27 +08:00 committed by Mark Brown
parent 6d068f1ae2
commit 550bc517e5
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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)