Skip to content

Commit

Permalink
IB/core: Nullify ib_uobject during allocation
Browse files Browse the repository at this point in the history
Currently, we initialize all fields of ib_uobject straight after
allocation. Therefore, a kmalloc was sufficient. Since ib_uobject
could be embedded in a type specific structure, we nullify it to
spare programmer errors.

Fixes: 3832125 ('IB/core: Add support for idr types')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Matan Barak authored and Doug Ledford committed Apr 20, 2017
1 parent f025c48 commit d9edfc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/core/rdma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int uverbs_try_lock_object(struct ib_uobject *uobj, bool exclusive)
static struct ib_uobject *alloc_uobj(struct ib_ucontext *context,
const struct uverbs_obj_type *type)
{
struct ib_uobject *uobj = kmalloc(type->obj_size, GFP_KERNEL);
struct ib_uobject *uobj = kzalloc(type->obj_size, GFP_KERNEL);

if (!uobj)
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit d9edfc5

Please sign in to comment.