Blob Blame History Raw
From: Parav Pandit <parav@mellanox.com>
Date: Wed, 13 Jun 2018 10:22:02 +0300
Subject: IB: Ensure that all rdma_ah_attr's are zero initialized
Patch-mainline: v4.19-rc1
Git-commit: fb51eecaa523c909cdc6240d3e9b8bfc74e7a888
References: bsc#1103992 FATE#326009

Since we are adding some new fields to this structure it is safest if all
users reliably initialize the struct to zero.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/infiniband/core/uverbs_cmd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1968,7 +1968,7 @@ static int modify_qp(struct ib_uverbs_fi
 	struct ib_qp *qp;
 	int ret;
 
-	attr = kmalloc(sizeof *attr, GFP_KERNEL);
+	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
 	if (!attr)
 		return -ENOMEM;
 
@@ -2601,7 +2601,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uv
 	struct ib_uobject		*uobj;
 	struct ib_pd			*pd;
 	struct ib_ah			*ah;
-	struct rdma_ah_attr		attr;
+	struct rdma_ah_attr		attr = {};
 	int ret;
 	struct ib_udata                   udata;