[ofa-general] [PATCH] libibverbs: Initialize reserved attributes in modify QP command

Dotan Barak dotanb at dev.mellanox.co.il
Wed Aug 8 06:27:08 PDT 2007


Initialize the reserved attributes in modify QP command to eliminate the 
following valgrind warnings:

==23549== Syscall param write(buf) points to uninitialised byte(s)
==23549==    at 0x316B1B933F: (within /lib64/tls/libc-2.3.4.so)
==23549==    by 0x4A33AF7: ibv_cmd_modify_qp (cmd.c:782)
==23549==    by 0x4F860D8: mlx4_modify_qp (verbs.c:480)
==23549==    by 0x4A37A53: ibv_modify_qp@@IBVERBS_1.1 (verbs.c:441)
==23549==    by 0x40972E: qp_reset_to_rtr (mr_test_fun.c:1189)
==23549==    by 0x403AFC: mr_test_connect_qp (mr_test.c:232)
==23549==    by 0x404956: do_test (mr_test.c:85)
==23549==    by 0x402DF8: main (main.c:448)
==23549==  Address 0x7FEFFF2AE is on thread 1's stack


Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

diff --git a/src/cmd.c b/src/cmd.c
index a0bfaad..6d4331f 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -756,6 +756,7 @@ int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
 	memcpy(cmd->dest.dgid, attr->ah_attr.grh.dgid.raw, 16);
 	cmd->dest.flow_label 	    = attr->ah_attr.grh.flow_label;
 	cmd->dest.dlid 		    = attr->ah_attr.dlid;
+	cmd->dest.reserved	    = 0;
 	cmd->dest.sgid_index 	    = attr->ah_attr.grh.sgid_index;
 	cmd->dest.hop_limit 	    = attr->ah_attr.grh.hop_limit;
 	cmd->dest.traffic_class     = attr->ah_attr.grh.traffic_class;
@@ -768,6 +769,7 @@ int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
 	memcpy(cmd->alt_dest.dgid, attr->alt_ah_attr.grh.dgid.raw, 16);
 	cmd->alt_dest.flow_label    = attr->alt_ah_attr.grh.flow_label;
 	cmd->alt_dest.dlid 	    = attr->alt_ah_attr.dlid;
+	cmd->alt_dest.reserved	    = 0;
 	cmd->alt_dest.sgid_index    = attr->alt_ah_attr.grh.sgid_index;
 	cmd->alt_dest.hop_limit     = attr->alt_ah_attr.grh.hop_limit;
 	cmd->alt_dest.traffic_class = attr->alt_ah_attr.grh.traffic_class;



More information about the general mailing list