Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52924434 authored by Steve Wise's avatar Steve Wise Committed by Doug Ledford
Browse files

mlx4_ib: zero out struct ib_pd when allocating



Zero out the fields of the struct ib_pd for user mode pds so that
users querying pds via nldev will not get garbage.  For simplicity,
use kzalloc() to allocate the mlx4_ib_pd struct.

Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent fccec5b8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1327,7 +1327,7 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev,
	struct mlx4_ib_pd *pd;
	int err;

	pd = kmalloc(sizeof *pd, GFP_KERNEL);
	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
	if (!pd)
		return ERR_PTR(-ENOMEM);

@@ -1343,7 +1343,6 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev,
			kfree(pd);
			return ERR_PTR(-EFAULT);
		}

	return &pd->ibpd;
}