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

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>

authored by

Qianfeng Rong and committed by
Mark Brown
550bc517 6d068f1a

+1 -1
+1 -1
drivers/regulator/bd718x7-regulator.c
··· 1598 1598 if (desc->n_linear_ranges && desc->linear_ranges) { 1599 1599 struct linear_range *new; 1600 1600 1601 - new = devm_kzalloc(dev, desc->n_linear_ranges * 1601 + new = devm_kcalloc(dev, desc->n_linear_ranges, 1602 1602 sizeof(struct linear_range), 1603 1603 GFP_KERNEL); 1604 1604 if (!new)