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>
Este commit está contenido en:

cometido por
Jason Gunthorpe

padre
e5c1bb47cc
commit
459cc69fa4
@@ -3669,7 +3669,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
|
||||
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
||||
struct nes_device *nesdev = nesvnic->nesdev;
|
||||
|
||||
nesibdev = (struct nes_ib_device *)ib_alloc_device(sizeof(struct nes_ib_device));
|
||||
nesibdev = ib_alloc_device(nes_ib_device, ibdev);
|
||||
if (nesibdev == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
Referencia en una nueva incidencia
Block a user