aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2011-12-06 16:15:18 -0500
committerRoland Dreier <roland@purestorage.com>2012-01-04 12:13:52 -0500
commit46ea5061c750fc6b088b9566234287115fb70f98 (patch)
treedb5ad08595bac4e37b508f697b950246bb87aba3 /drivers/infiniband
parent5f0a6e2d503896062f641639dacfe5055c2f593b (diff)
RDMA/cma: Fix endianness bugs
Fix endianness bugs reported by sparse in the RDMA core stack. Note that these are real bugs, but don't affect any existing code to the best of my knowledge. The mlid issue would only affect kernel users of rdma_join_multicast which have the rdma_cm attach/detach its QP. There are no current in tree users that do this. (rdma_join_multicast may be used called by user space applications, which does not have this issue.) And the pkey setting is simply returned as informational. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d0d4aa9f4802..fdd8ef8dad32 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1110,7 +1110,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
1110 if (cma_any_addr((struct sockaddr *) &rt->addr.src_addr)) { 1110 if (cma_any_addr((struct sockaddr *) &rt->addr.src_addr)) {
1111 rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND; 1111 rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND;
1112 rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid); 1112 rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
1113 ib_addr_set_pkey(&rt->addr.dev_addr, rt->path_rec[0].pkey); 1113 ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
1114 } else { 1114 } else {
1115 ret = rdma_translate_ip((struct sockaddr *) &rt->addr.src_addr, 1115 ret = rdma_translate_ip((struct sockaddr *) &rt->addr.src_addr,
1116 &rt->addr.dev_addr); 1116 &rt->addr.dev_addr);
@@ -2926,7 +2926,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
2926 mutex_lock(&id_priv->qp_mutex); 2926 mutex_lock(&id_priv->qp_mutex);
2927 if (!status && id_priv->id.qp) 2927 if (!status && id_priv->id.qp)
2928 status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid, 2928 status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid,
2929 multicast->rec.mlid); 2929 be16_to_cpu(multicast->rec.mlid));
2930 mutex_unlock(&id_priv->qp_mutex); 2930 mutex_unlock(&id_priv->qp_mutex);
2931 2931
2932 memset(&event, 0, sizeof event); 2932 memset(&event, 0, sizeof event);
@@ -3187,7 +3187,7 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
3187 if (id->qp) 3187 if (id->qp)
3188 ib_detach_mcast(id->qp, 3188 ib_detach_mcast(id->qp,
3189 &mc->multicast.ib->rec.mgid, 3189 &mc->multicast.ib->rec.mgid,
3190 mc->multicast.ib->rec.mlid); 3190 be16_to_cpu(mc->multicast.ib->rec.mlid));
3191 if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) { 3191 if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) {
3192 switch (rdma_port_get_link_layer(id->device, id->port_num)) { 3192 switch (rdma_port_get_link_layer(id->device, id->port_num)) {
3193 case IB_LINK_LAYER_INFINIBAND: 3193 case IB_LINK_LAYER_INFINIBAND: