Commit 004c7a6
irqchip/bcm-6345-l1: Prefer struct_size)_ over open coded arithmetic
This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows.
The cpu variable is a pointer to "struct bcm6345_l1_cpu" and this structure
ends in a flexible array:
struct bcm6345_l1_cpu {
[...]
u32 enable_cache[];
};
The preferred way in the kernel is to use the struct_size() helper to do
the arithmetic instead of the argument "size + count * size" in the
kzalloc() function.
This way, the code is more readable and safer.
Signed-off-by: Erick Archer <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Link: KSPP/linux#162 [2]1 parent 83c0708 commit 004c7a6
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
0 commit comments