[openib-general] [PATCH] mthca: check alt_pkey_index in modify_qp + cosmetic change
Dotan Barak
dotanb at mellanox.co.il
Tue Feb 28 06:23:03 PST 2006
Added a check that the alternate pkey index is valid + cosmetic change.
Signed-off-by: Dotan Barak <dotanb at mellanox.co.il>
Index: latest/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- latest.orig/drivers/infiniband/hw/mthca/mthca_qp.c 2006-02-28
15:46:58.000000000 +0200
+++ latest/drivers/infiniband/hw/mthca/mthca_qp.c 2006-02-28
16:02:50.000000000 +0200
@@ -529,8 +529,8 @@ int mthca_modify_qp(struct ib_qp *ibqp,
if ((attr_mask & IB_QP_PKEY_INDEX) &&
attr->pkey_index >= dev->limits.pkey_table_len) {
- mthca_dbg(dev, "PKey index (%u) too large. max is %d\n",
- attr->pkey_index,dev->limits.pkey_table_len-1);
+ mthca_dbg(dev, "pkey_index (%u) too large. max is %d\n",
+ attr->pkey_index, dev->limits.pkey_table_len - 1);
return -EINVAL;
}
@@ -651,6 +651,13 @@ int mthca_modify_qp(struct ib_qp *ibqp,
return -EINVAL;
}
+ if (attr->alt_pkey_index >= dev->limits.pkey_table_len) {
+ mthca_dbg(dev, "alt_pkey_index (%u) too large. max is %d\n",
+ attr->alt_pkey_index,
+ dev->limits.pkey_table_len - 1);
+ return -EINVAL;
+ }
+
mthca_path_set(&attr->alt_ah_attr, &qp_context->alt_path);
qp_context->alt_path.port_pkey |=
cpu_to_be32(attr->alt_pkey_index |
attr->alt_port_num << 24);
More information about the general
mailing list