aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2019-01-30 12:49:11 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-01-30 15:52:30 -0700
commit459cc69fa4c17caf21de596693d8a07170820a58 (patch)
treec1ffe44d059b43b9507c5926873c3c56a4dd8bb3 /drivers/infiniband/core
parentIB/mlx5: Remove set but not used variable (diff)
downloadlinux-dev-459cc69fa4c17caf21de596693d8a07170820a58.tar.xz
linux-dev-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/core')
-rw-r--r--drivers/infiniband/core/device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 200431c540f2..b511cfa00bdb 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -268,7 +268,7 @@ static struct class ib_class = {
};
/**
- * ib_alloc_device - allocate an IB device struct
+ * _ib_alloc_device - allocate an IB device struct
* @size:size of structure to allocate
*
* Low-level drivers should use ib_alloc_device() to allocate &struct
@@ -277,7 +277,7 @@ static struct class ib_class = {
* ib_dealloc_device() must be used to free structures allocated with
* ib_alloc_device().
*/
-struct ib_device *ib_alloc_device(size_t size)
+struct ib_device *_ib_alloc_device(size_t size)
{
struct ib_device *device;
@@ -303,7 +303,7 @@ struct ib_device *ib_alloc_device(size_t size)
return device;
}
-EXPORT_SYMBOL(ib_alloc_device);
+EXPORT_SYMBOL(_ib_alloc_device);
/**
* ib_dealloc_device - free an IB device struct