OSDN Git Service

net/mlx5: Use struct_size() helper in kvzalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 28 Sep 2021 22:11:57 +0000 (17:11 -0500)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 30 Sep 2021 23:19:02 +0000 (16:19 -0700)
commitab9ace34158f48e65024e21994ed83d065e2ce6e
tree34991274a8a75c41edb4b943ce3896a793ed7d68
parent806bf340e18017f1b30ec8ed3273a6a9523fbe82
net/mlx5: Use struct_size() helper in kvzalloc()

Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows that,
in the worse scenario, could lead to heap overflows.

Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c