diff options
author | Amir Vadai <amirv@mellanox.com> | 2015-06-04 19:30:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-04 16:41:00 -0700 |
commit | 5e24851ec502334986c2ac775beb4b7184a0b6c5 (patch) | |
tree | 5d36a97493ba9c73dd59aa9f9a947e8609ff605a | |
parent | 6a0d7a054f90442ab9788b1435be4b69c262b37f (diff) | |
download | linux-5e24851ec502334986c2ac775beb4b7184a0b6c5.tar.bz2 |
net/mlx5_en: Add missing check for memory allocation failure
The patch afb736e9330a: "net/mlx5: Ethernet resource handling files"
from May 28, 2015, leads to the following static checker warning:
drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c:726 mlx5e_create_main_flow_table()
error: potential null dereference 'g'. (kcalloc returns null)
Fixes: afb736e9330a ("net/mlx5: Ethernet resource handling files")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c index 6feebda4b3e4..120db80c47aa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c @@ -722,6 +722,8 @@ static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) u8 *dmac; g = kcalloc(9, sizeof(*g), GFP_KERNEL); + if (!g) + return -ENOMEM; g[0].log_sz = 2; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; |