diff options
Diffstat (limited to 'drivers/infiniband/core/cache.c')
| -rw-r--r-- | drivers/infiniband/core/cache.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 0fc1c5bce2f0..c3d542187129 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -296,14 +296,14 @@ alloc_gid_entry(const struct ib_gid_attr *attr) struct ib_gid_table_entry *entry; struct net_device *ndev; - entry = kzalloc(sizeof(*entry), GFP_KERNEL); + entry = kzalloc_obj(*entry, GFP_KERNEL); if (!entry) return NULL; ndev = rcu_dereference_protected(attr->ndev, 1); if (ndev) { - entry->ndev_storage = kzalloc(sizeof(*entry->ndev_storage), - GFP_KERNEL); + entry->ndev_storage = kzalloc_obj(*entry->ndev_storage, + GFP_KERNEL); if (!entry->ndev_storage) { kfree(entry); return NULL; @@ -771,12 +771,12 @@ const struct ib_gid_attr *rdma_find_gid_by_filter( static struct ib_gid_table *alloc_gid_table(int sz) { - struct ib_gid_table *table = kzalloc(sizeof(*table), GFP_KERNEL); + struct ib_gid_table *table = kzalloc_obj(*table, GFP_KERNEL); if (!table) return NULL; - table->data_vec = kcalloc(sz, sizeof(*table->data_vec), GFP_KERNEL); + table->data_vec = kzalloc_objs(*table->data_vec, sz, GFP_KERNEL); if (!table->data_vec) goto err_free_table; @@ -1452,7 +1452,7 @@ ib_cache_update(struct ib_device *device, u32 port, bool update_gids, if (!rdma_is_port_valid(device, port)) return -EINVAL; - tprops = kmalloc(sizeof *tprops, GFP_KERNEL); + tprops = kmalloc_obj(*tprops, GFP_KERNEL); if (!tprops) return -ENOMEM; @@ -1472,9 +1472,8 @@ ib_cache_update(struct ib_device *device, u32 port, bool update_gids, update_pkeys &= !!tprops->pkey_tbl_len; if (update_pkeys) { - pkey_cache = kmalloc(struct_size(pkey_cache, table, - tprops->pkey_tbl_len), - GFP_KERNEL); + pkey_cache = kmalloc_flex(*pkey_cache, table, + tprops->pkey_tbl_len, GFP_KERNEL); if (!pkey_cache) { ret = -ENOMEM; goto err; @@ -1583,7 +1582,7 @@ void ib_dispatch_event(const struct ib_event *event) { struct ib_update_work *work; - work = kzalloc(sizeof(*work), GFP_ATOMIC); + work = kzalloc_obj(*work, GFP_ATOMIC); if (!work) return; |
