mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 03:18:31 +00:00
IB/core: Nullify ib_uobject during allocation
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: 3832125624
('IB/core: Add support for idr types')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
f025c48958
commit
d9edfc5a4f
1 changed files with 1 additions and 1 deletions
|
@ -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,
|
static struct ib_uobject *alloc_uobj(struct ib_ucontext *context,
|
||||||
const struct uverbs_obj_type *type)
|
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)
|
if (!uobj)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
Loading…
Reference in a new issue