treewide: Replace more open-coded allocation size multiplications
As done treewide earlier, this catches several more open-coded allocation size calculations that were added to the kernel during the merge window. This performs the following mechanical transformations using Coccinelle: kvmalloc(a * b, ...) -> kvmalloc_array(a, b, ...) kvzalloc(a * b, ...) -> kvcalloc(a, b, ...) devm_kzalloc(..., a * b, ...) -> devm_kcalloc(..., a, b, ...) Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
@@ -908,7 +908,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev,
|
||||
if (fan_cnt < 1)
|
||||
return -EINVAL;
|
||||
|
||||
fan_ch = devm_kzalloc(dev, sizeof(*fan_ch) * fan_cnt, GFP_KERNEL);
|
||||
fan_ch = devm_kcalloc(dev, fan_cnt, sizeof(*fan_ch), GFP_KERNEL);
|
||||
if (!fan_ch)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Reference in New Issue
Block a user