[openib-general] [PATCH v2] mthca: fix uninitialized variable in mthca_alloc_qp

Jack Morgenstein jackm at mellanox.co.il
Tue Mar 21 23:52:31 PST 2006


qp->transport was used uninitialized in mthca_alloc_qp() and
in mthca_alloc_sqp() by mthca_set_qp_size()

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: src/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- src.orig/drivers/infiniband/hw/mthca/mthca_qp.c	(revision 5945)
+++ src/drivers/infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -1175,10 +1175,6 @@ int mthca_alloc_qp(struct mthca_dev *dev
 {
 	int err;
 
-	err = mthca_set_qp_size(dev, cap, pd, qp);
-	if (err)
-		return err;
-
 	switch (type) {
 	case IB_QPT_RC: qp->transport = RC; break;
 	case IB_QPT_UC: qp->transport = UC; break;
@@ -1186,6 +1182,10 @@ int mthca_alloc_qp(struct mthca_dev *dev
 	default: return -EINVAL;
 	}
 
+	err = mthca_set_qp_size(dev, cap, pd, qp);
+	if (err)
+		return err;
+
 	qp->qpn = mthca_alloc(&dev->qp_table.alloc);
 	if (qp->qpn == -1)
 		return -ENOMEM;
@@ -1218,6 +1218,7 @@ int mthca_alloc_sqp(struct mthca_dev *de
 	u32 mqpn = qpn * 2 + dev->qp_table.sqp_start + port - 1;
 	int err;
 
+	sqp->qp.transport = MLX;
 	err = mthca_set_qp_size(dev, cap, pd, &sqp->qp);
 	if (err)
 		return err;



More information about the general mailing list