diff options
author | Len Baker <len.baker@gmx.com> | 2021-09-05 09:49:36 +0200 |
---|---|---|
committer | Saeed Mahameed <saeedm@nvidia.com> | 2021-10-15 17:37:46 -0700 |
commit | 0e6f3ef469bbf69ea6840aa4d15dcfc8ce978760 (patch) | |
tree | 399ee59e17a0e823da3b69e04534183c5c55e85b /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 0885ae1a9d34d946e12c1cf9834463ee3541a63a (diff) |
net/mlx5: DR, Prefer kcalloc over open coded arithmetic
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, refactor the code a bit to use the purpose specific kcalloc()
function instead of the argument size * count in the kzalloc() function.
[1] https://www.kernel.org/doc/html/v5.14/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Signed-off-by: Len Baker <len.baker@gmx.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions