diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-08-31 20:07:24 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-03 20:57:10 +0300 |
commit | 942e7e5fc1ea4625d971e62f00b5ae3d2f8855de (patch) | |
tree | 6a28e9af593aca2cea3243d90f64d4a9820f025c /drivers/net/ethernet/mellanox/mlx4 | |
parent | 542deb88b0e3696ec9986e804628158169200776 (diff) | |
download | linux-942e7e5fc1ea4625d971e62f00b5ae3d2f8855de.tar.xz |
net/mlx4_core: fix incorrect size allocation for dev->caps.spec_qps
The current allocation for dev->caps.spec_qps is for the size of the
pointer and not the size of the actual mlx4_spec_qps structure. Fix
this by using the correct size. Also splint allocation over a few
lines to make it cppcheck clean on overly wide lines.
Detected by CoverityScan, CID#1455222 ("Wrong sizeof argument")
Fixes: c73c8b1e47ca ("net/mlx4_core: Dynamically allocate structs at mlx4_slave_cap")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/qp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 28c441c0d31f..e40a6d1d0966 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c @@ -844,8 +844,9 @@ int mlx4_init_qp_table(struct mlx4_dev *dev) /* In mfunc, calculate proxy and tunnel qp offsets for the PF here, * since the PF does not call mlx4_slave_caps */ - dev->caps.spec_qps = kcalloc(dev->caps.num_ports, sizeof(dev->caps.spec_qps), GFP_KERNEL); - + dev->caps.spec_qps = kcalloc(dev->caps.num_ports, + sizeof(*dev->caps.spec_qps), + GFP_KERNEL); if (!dev->caps.spec_qps) { err = -ENOMEM; goto err_mem; |