aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes/nes_cm.c
diff options
context:
space:
mode:
authorDon Wood <donald.e.wood@intel.com>2009-04-08 17:21:02 -0400
committerRoland Dreier <rolandd@cisco.com>2009-04-08 17:21:02 -0400
commit7a5efb62f6ae366cefac6be475434906c5061e15 (patch)
tree834615c1a5928d196aec846cfe2742cea168a78c /drivers/infiniband/hw/nes/nes_cm.c
parent5d80f8e5a9dc9c9a94d4aeaa567e219a808b8a4a (diff)
RDMA/nes: Fix incorrect casts on 32-bit architectures
The were some incorrect casts to unsigned long that caused 64-bit values to be truncated on 32-bit architectures and made the driver pass invalid adresses and lengths to the hardware. The problems were primarily seen with kernels with highmem configured but some could show up in non-highmem kernels, too. Signed-off-by: Don Wood <donald.e.wood@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_cm.c')
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 52425154acd4..7c942470b980 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -2690,6 +2690,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2690 struct ib_mr *ibmr = NULL; 2690 struct ib_mr *ibmr = NULL;
2691 struct ib_phys_buf ibphysbuf; 2691 struct ib_phys_buf ibphysbuf;
2692 struct nes_pd *nespd; 2692 struct nes_pd *nespd;
2693 u64 tagged_offset;
2693 2694
2694 2695
2695 2696
@@ -2755,10 +2756,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2755 ibphysbuf.addr = nesqp->ietf_frame_pbase; 2756 ibphysbuf.addr = nesqp->ietf_frame_pbase;
2756 ibphysbuf.size = conn_param->private_data_len + 2757 ibphysbuf.size = conn_param->private_data_len +
2757 sizeof(struct ietf_mpa_frame); 2758 sizeof(struct ietf_mpa_frame);
2759 tagged_offset = (u64)(unsigned long)nesqp->ietf_frame;
2758 ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd, 2760 ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
2759 &ibphysbuf, 1, 2761 &ibphysbuf, 1,
2760 IB_ACCESS_LOCAL_WRITE, 2762 IB_ACCESS_LOCAL_WRITE,
2761 (u64 *)&nesqp->ietf_frame); 2763 &tagged_offset);
2762 if (!ibmr) { 2764 if (!ibmr) {
2763 nes_debug(NES_DBG_CM, "Unable to register memory region" 2765 nes_debug(NES_DBG_CM, "Unable to register memory region"
2764 "for lSMM for cm_node = %p \n", 2766 "for lSMM for cm_node = %p \n",
@@ -2782,7 +2784,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2782 sizeof(struct ietf_mpa_frame)); 2784 sizeof(struct ietf_mpa_frame));
2783 set_wqe_64bit_value(wqe->wqe_words, 2785 set_wqe_64bit_value(wqe->wqe_words,
2784 NES_IWARP_SQ_WQE_FRAG0_LOW_IDX, 2786 NES_IWARP_SQ_WQE_FRAG0_LOW_IDX,
2785 (u64)nesqp->ietf_frame); 2787 (u64)(unsigned long)nesqp->ietf_frame);
2786 wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] = 2788 wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] =
2787 cpu_to_le32(conn_param->private_data_len + 2789 cpu_to_le32(conn_param->private_data_len +
2788 sizeof(struct ietf_mpa_frame)); 2790 sizeof(struct ietf_mpa_frame));