[ofa-general] [PATCH] infiniband-diags/saquery: fix encoding of SA queries

Sasha Khapyorsky sashak at voltaire.com
Thu Jan 29 05:04:07 PST 2009


Various queries encoding fixes:

- PortInfoRecord: PortNum has length 8 bit and should not be converted to
  network byte order.
- NodeRecord: initialize lid value to prevent garbage in a query.
- PkeyTableRecord: BlockNumber has 16 bit length and should be encoded
  in network byte order.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

I found one more encoding bug and decided to merge this with previoisly
posted similar patches.

 infiniband-diags/src/saquery.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index 9dd3bdb..e6a8d52 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -1078,7 +1078,7 @@ static int query_node_records(const struct query_cmd *q,
 {
 	ib_node_record_t nr;
 	ib_net64_t comp_mask = 0;
-	int lid;
+	int lid = 0;
 	ib_api_status_t status;
 
 	if (argc > 0)
@@ -1121,7 +1121,7 @@ static int query_portinfo_records(const struct query_cmd *q,
 		comp_mask |= IB_PIR_COMPMASK_LID;
 	}
 	if (port >= 0) {
-		pir.port_num = cl_hton16(port);
+		pir.port_num = port;
 		comp_mask |= IB_PIR_COMPMASK_PORTNUM;
 	}
 
@@ -1316,7 +1316,7 @@ static int query_pkey_tbl_records(const struct query_cmd *q,
 		comp_mask |= IB_PKEY_COMPMASK_PORT;
 	}
 	if (block >= 0) {
-		pktr.block_num = block;
+		pktr.block_num = cl_hton16(block);
 		comp_mask |= IB_PKEY_COMPMASK_BLOCK;
 	}
 
-- 
1.6.0.4.766.g6fc4a




More information about the general mailing list