diff options
author | Don Wood <donald.e.wood@intel.com> | 2009-04-08 17:21:02 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2009-04-08 17:21:02 -0400 |
commit | 7a5efb62f6ae366cefac6be475434906c5061e15 (patch) | |
tree | 834615c1a5928d196aec846cfe2742cea168a78c /drivers/infiniband | |
parent | 5d80f8e5a9dc9c9a94d4aeaa567e219a808b8a4a (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')
-rw-r--r-- | drivers/infiniband/hw/nes/nes.h | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 04b12ad23390..17621de54a9f 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
@@ -289,8 +289,8 @@ static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad) | |||
289 | static inline void | 289 | static inline void |
290 | set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) | 290 | set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) |
291 | { | 291 | { |
292 | wqe_words[index] = cpu_to_le32((u32) ((unsigned long)value)); | 292 | wqe_words[index] = cpu_to_le32((u32) value); |
293 | wqe_words[index + 1] = cpu_to_le32((u32)(upper_32_bits((unsigned long)value))); | 293 | wqe_words[index + 1] = cpu_to_le32(upper_32_bits(value)); |
294 | } | 294 | } |
295 | 295 | ||
296 | static inline void | 296 | static inline void |
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)); |