diff mbox

[4/4] IB/uverbs: ex_query_device: no need to clear the whole structure

Message ID 20d9ee35f60f24b9db5c58333a64b7d70e8c9018.1421931555.git.ydroneaud@opteya.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Yann Droneaud Jan. 22, 2015, 1:28 p.m. UTC
As only the requested fields are set and copied to userspace,
there's no need to clear the content of the response structure
beforehand.

Link: http://mid.gmane.org/cover.1421931555.git.ydroneaud@opteya.com
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Shachar Raindel <raindel@mellanox.com>
Cc: Eli Cohen <eli@mellanox.com>
Cc: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 80a1c90f1dbf..bedcd8499c9c 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3331,9 +3331,9 @@  int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	if (err)
 		return err;
 
-	memset(&resp, 0, sizeof(resp));
 	copy_query_dev_fields(file, &resp.base, &attr);
 	resp.comp_mask = 0;
+	resp.reserved = 0;
 
 #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
 	if (cmd.comp_mask & IB_USER_VERBS_EX_QUERY_DEVICE_ODP) {
@@ -3349,6 +3349,9 @@  int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 			attr.odp_caps.per_transport_caps.uc_odp_caps;
 		resp.odp_caps.per_transport_caps.ud_odp_caps =
 			attr.odp_caps.per_transport_caps.ud_odp_caps;
+
+		resp.odp_caps.reserved = 0;
+
 		resp.comp_mask |= IB_USER_VERBS_EX_QUERY_DEVICE_ODP;
 	}
 #endif