Commit 5d265770 authored by Kaike Wan's avatar Kaike Wan Committed by Doug Ledford

IB/sa: Allocate SA query with kzalloc

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: default avatarKaike Wan <kaike.wan@intel.com>
Signed-off-by: default avatarJohn Fleck <john.fleck@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent bc10ed7d
...@@ -740,7 +740,7 @@ int ib_sa_path_rec_get(struct ib_sa_client *client, ...@@ -740,7 +740,7 @@ int ib_sa_path_rec_get(struct ib_sa_client *client,
port = &sa_dev->port[port_num - sa_dev->start_port]; port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent; agent = port->agent;
query = kmalloc(sizeof *query, gfp_mask); query = kzalloc(sizeof(*query), gfp_mask);
if (!query) if (!query)
return -ENOMEM; return -ENOMEM;
...@@ -862,7 +862,7 @@ int ib_sa_service_rec_query(struct ib_sa_client *client, ...@@ -862,7 +862,7 @@ int ib_sa_service_rec_query(struct ib_sa_client *client,
method != IB_SA_METHOD_DELETE) method != IB_SA_METHOD_DELETE)
return -EINVAL; return -EINVAL;
query = kmalloc(sizeof *query, gfp_mask); query = kzalloc(sizeof(*query), gfp_mask);
if (!query) if (!query)
return -ENOMEM; return -ENOMEM;
...@@ -954,7 +954,7 @@ int ib_sa_mcmember_rec_query(struct ib_sa_client *client, ...@@ -954,7 +954,7 @@ int ib_sa_mcmember_rec_query(struct ib_sa_client *client,
port = &sa_dev->port[port_num - sa_dev->start_port]; port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent; agent = port->agent;
query = kmalloc(sizeof *query, gfp_mask); query = kzalloc(sizeof(*query), gfp_mask);
if (!query) if (!query)
return -ENOMEM; return -ENOMEM;
...@@ -1051,7 +1051,7 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client, ...@@ -1051,7 +1051,7 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client,
port = &sa_dev->port[port_num - sa_dev->start_port]; port = &sa_dev->port[port_num - sa_dev->start_port];
agent = port->agent; agent = port->agent;
query = kmalloc(sizeof *query, gfp_mask); query = kzalloc(sizeof(*query), gfp_mask);
if (!query) if (!query)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment