提交 7a5efb62 编写于 作者: D Don Wood 提交者: Roland Dreier

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: NDon Wood <donald.e.wood@intel.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 5d80f8e5
...@@ -289,8 +289,8 @@ static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad) ...@@ -289,8 +289,8 @@ static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad)
static inline void static inline void
set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value)
{ {
wqe_words[index] = cpu_to_le32((u32) ((unsigned long)value)); wqe_words[index] = cpu_to_le32((u32) value);
wqe_words[index + 1] = cpu_to_le32((u32)(upper_32_bits((unsigned long)value))); wqe_words[index + 1] = cpu_to_le32(upper_32_bits(value));
} }
static inline void static inline void
......
...@@ -2690,6 +2690,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2690,6 +2690,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
struct ib_mr *ibmr = NULL; struct ib_mr *ibmr = NULL;
struct ib_phys_buf ibphysbuf; struct ib_phys_buf ibphysbuf;
struct nes_pd *nespd; struct nes_pd *nespd;
u64 tagged_offset;
...@@ -2755,10 +2756,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2755,10 +2756,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ibphysbuf.addr = nesqp->ietf_frame_pbase; ibphysbuf.addr = nesqp->ietf_frame_pbase;
ibphysbuf.size = conn_param->private_data_len + ibphysbuf.size = conn_param->private_data_len +
sizeof(struct ietf_mpa_frame); sizeof(struct ietf_mpa_frame);
tagged_offset = (u64)(unsigned long)nesqp->ietf_frame;
ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd, ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
&ibphysbuf, 1, &ibphysbuf, 1,
IB_ACCESS_LOCAL_WRITE, IB_ACCESS_LOCAL_WRITE,
(u64 *)&nesqp->ietf_frame); &tagged_offset);
if (!ibmr) { if (!ibmr) {
nes_debug(NES_DBG_CM, "Unable to register memory region" nes_debug(NES_DBG_CM, "Unable to register memory region"
"for lSMM for cm_node = %p \n", "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,7 +2784,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
sizeof(struct ietf_mpa_frame)); sizeof(struct ietf_mpa_frame));
set_wqe_64bit_value(wqe->wqe_words, set_wqe_64bit_value(wqe->wqe_words,
NES_IWARP_SQ_WQE_FRAG0_LOW_IDX, NES_IWARP_SQ_WQE_FRAG0_LOW_IDX,
(u64)nesqp->ietf_frame); (u64)(unsigned long)nesqp->ietf_frame);
wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] = wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] =
cpu_to_le32(conn_param->private_data_len + cpu_to_le32(conn_param->private_data_len +
sizeof(struct ietf_mpa_frame)); sizeof(struct ietf_mpa_frame));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册