Commit 252c31a
clk: hisilicon: Use devm_kcalloc() instead of devm_kzalloc()
As noted in the "Deprecated Interfaces, Language Features, Attributes,
and Conventions" documentation [1], size calculations (especially
multiplication) should not be performed in memory allocator (or similar)
function arguments due to the risk of them overflowing. This could lead
to values wrapping around and a smaller allocation being made than the
caller was expecting. Using those allocations could lead to linear
overflows of heap memory and other misbehaviors.
So, use the purpose specific devm_kcalloc() function instead of the
argument size * count in the devm_kzalloc() function.
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Link: KSPP/linux#162
Signed-off-by: Erick Archer <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>1 parent 64c6a38 commit 252c31a
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
464 | | - | |
465 | | - | |
| 464 | + | |
466 | 465 | | |
467 | 466 | | |
468 | 467 | | |
| |||
0 commit comments