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>
Цей коміт міститься в:

зафіксовано
Jason Gunthorpe

джерело
e5c1bb47cc
коміт
459cc69fa4
@@ -297,7 +297,7 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
|
||||
u8 lstate = 0;
|
||||
struct ocrdma_dev *dev;
|
||||
|
||||
dev = (struct ocrdma_dev *)ib_alloc_device(sizeof(struct ocrdma_dev));
|
||||
dev = ib_alloc_device(ocrdma_dev, ibdev);
|
||||
if (!dev) {
|
||||
pr_err("Unable to allocate ib device\n");
|
||||
return NULL;
|
||||
|
Посилання в новій задачі
Заблокувати користувача