Hello,
kernel test robot noticed "kunit.fortify.alloc_size_kmalloc_dynamic_test.fail"
on:
commit: 4ce615e798a752d4431fcc52960478906dec2f0e ("fortify: Provide KUnit
counters for failure testing")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
[test failed on linus/mas
* Erick Archer wrote:
> 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 is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].
As the "info" variable is a pointer to "struct sa_info" and this
structure ends in a flexible array:
struct sa_info {
[...]
struct sa_subdev_info subdev[];
Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().
Also, it is preferred to use sizeof(*pointer) instead of
sizeof(type) due to the type of the variable can change and
one needs not change the former (unlike the latter).
Link: https://github.com/KSPP/linux/issues/162
Review
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 wrappin
This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1].
Here the multiplication is obviously safe because the "channels"
member can only be 8 or 2. This value is set when the "vendor_data"
structs are initialized.
static struct vend
This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].
As the "box" variable is a pointer to "struct intel_uncore_box" and
this structure ends in a flexible array:
struct intel_uncore_box {
[...]
struct intel_unc