From: Dan Carpenter Date: Thu, 3 Jun 2021 12:39:24 +0000 (+0300) Subject: net/mlx5: check for allocation failure in mlx5_ft_pool_init() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b74fc1ca6a45897e97f69a12b381bac415b75a5f;p=linux.git net/mlx5: check for allocation failure in mlx5_ft_pool_init() Add a check for if the kzalloc() fails. Fixes: 4a98544d1827 ("net/mlx5: Move chains ft pool to be used by all firmware steering") Signed-off-by: Dan Carpenter Acked-by: Leon Romanovsky Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c index 526fbb669142d..c14590acc7726 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c @@ -27,6 +27,8 @@ int mlx5_ft_pool_init(struct mlx5_core_dev *dev) int i; ft_pool = kzalloc(sizeof(*ft_pool), GFP_KERNEL); + if (!ft_pool) + return -ENOMEM; for (i = ARRAY_SIZE(FT_POOLS) - 1; i >= 0; i--) ft_pool->ft_left[i] = FT_SIZE / FT_POOLS[i];