Skip to content

Commit

Permalink
IB/sa: Allocate SA query with kzalloc
Browse files Browse the repository at this point in the history
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 <kaike.wan@intel.com>
Signed-off-by: John Fleck <john.fleck@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Kaike Wan authored and Doug Ledford committed Aug 30, 2015
1 parent bc10ed7 commit 5d26577
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
agent = port->agent;

query = kmalloc(sizeof *query, gfp_mask);
query = kzalloc(sizeof(*query), gfp_mask);
if (!query)
return -ENOMEM;

Expand Down Expand Up @@ -862,7 +862,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;

Expand Down Expand Up @@ -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];
agent = port->agent;

query = kmalloc(sizeof *query, gfp_mask);
query = kzalloc(sizeof(*query), gfp_mask);
if (!query)
return -ENOMEM;

Expand Down Expand Up @@ -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];
agent = port->agent;

query = kmalloc(sizeof *query, gfp_mask);
query = kzalloc(sizeof(*query), gfp_mask);
if (!query)
return -ENOMEM;

Expand Down

0 comments on commit 5d26577

Please sign in to comment.