diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-01-30 12:49:11 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-01-30 15:52:30 -0700 |
commit | 459cc69fa4c17caf21de596693d8a07170820a58 (patch) | |
tree | c1ffe44d059b43b9507c5926873c3c56a4dd8bb3 /drivers/infiniband/hw/cxgb4 | |
parent | e5c1bb47cca679e9b9e286981d64fd08792e1e80 (diff) | |
download | linux-stable-459cc69fa4c17caf21de596693d8a07170820a58.tar.gz linux-stable-459cc69fa4c17caf21de596693d8a07170820a58.tar.bz2 linux-stable-459cc69fa4c17caf21de596693d8a07170820a58.zip |
RDMA: Provide safe ib_alloc_device() function
All callers to ib_alloc_device() provide a larger size than struct
ib_device and rely on the fact that struct ib_device is embedded in their
driver specific structure as the first member.
Provide a safer variant of ib_alloc_device() that checks and enforces this
approach to make sure the drivers are using it right.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/device.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 9c10fff6dcfb..4b4e2464b705 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -966,7 +966,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) pr_info("%s: On-Chip Queues not supported on this device\n", pci_name(infop->pdev)); - devp = (struct c4iw_dev *)ib_alloc_device(sizeof(*devp)); + devp = ib_alloc_device(c4iw_dev, ibdev); if (!devp) { pr_err("Cannot allocate ib device\n"); return ERR_PTR(-ENOMEM); |