From: Kaike Wan Date: Fri, 14 Aug 2015 12:52:08 +0000 (-0400) Subject: IB/sa: Allocate SA query with kzalloc X-Git-Tag: v4.1.12-102.0.20170601_1400~218 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3d150c6c0c22d972f7f2c79a1539dc8b992ad724;p=users%2Fjedix%2Flinux-maple.git IB/sa: Allocate SA query with kzalloc Orabug: 26124118 Replace kmalloc with kzalloc so that all uninitialized fields in SA query will be zero-ed out to avoid unintentional consequence. This prepares the SA query structure to accept new fields in the future. Signed-off-by: Kaike Wan Signed-off-by: John Fleck Signed-off-by: Ira Weiny Signed-off-by: Doug Ledford (cherry picked from commit 5d2657708ec25b9fb3dd174443b1f647babcbe62) Signed-off-by: Yuval Shaia Reviewed-by: Shamir Rabinovitch --- diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index ced6b6d05255b..d2bf4c3b9a01b 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -1217,7 +1217,7 @@ int ib_sa_path_rec_get(struct ib_sa_client *client, port = &sa_dev->port[port_num - sa_dev->start_port]; agent = port->agent; - query = kmalloc(sizeof *query, gfp_mask); + query = kzalloc(sizeof(*query), gfp_mask); if (!query) return -ENOMEM; @@ -1342,7 +1342,7 @@ int ib_sa_service_rec_query(struct ib_sa_client *client, method != IB_SA_METHOD_DELETE) return -EINVAL; - query = kmalloc(sizeof *query, gfp_mask); + query = kzalloc(sizeof(*query), gfp_mask); if (!query) return -ENOMEM; @@ -1434,7 +1434,7 @@ int ib_sa_mcmember_rec_query(struct ib_sa_client *client, port = &sa_dev->port[port_num - sa_dev->start_port]; agent = port->agent; - query = kmalloc(sizeof *query, gfp_mask); + query = kzalloc(sizeof(*query), gfp_mask); if (!query) return -ENOMEM; @@ -1531,7 +1531,7 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client, port = &sa_dev->port[port_num - sa_dev->start_port]; agent = port->agent; - query = kmalloc(sizeof *query, gfp_mask); + query = kzalloc(sizeof(*query), gfp_mask); if (!query) return -ENOMEM;