Commit 7e8e611d authored by Chengguang Xu's avatar Chengguang Xu Committed by Jason Gunthorpe

RDMA/rxe: Change variable and function argument to proper type

The type of wqe length is u32 so in order to avoid overflow and shadow
casting change variable and relevant function argument to proper type.

Link: https://lore.kernel.org/r/20220307145047.3235675-1-cgxu519@mykernel.netSigned-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 6f6dbb81
...@@ -359,7 +359,7 @@ static inline int get_mtu(struct rxe_qp *qp) ...@@ -359,7 +359,7 @@ static inline int get_mtu(struct rxe_qp *qp)
static struct sk_buff *init_req_packet(struct rxe_qp *qp, static struct sk_buff *init_req_packet(struct rxe_qp *qp,
struct rxe_send_wqe *wqe, struct rxe_send_wqe *wqe,
int opcode, int payload, int opcode, u32 payload,
struct rxe_pkt_info *pkt) struct rxe_pkt_info *pkt)
{ {
struct rxe_dev *rxe = to_rdev(qp->ibqp.device); struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
...@@ -449,7 +449,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp, ...@@ -449,7 +449,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,
static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
struct rxe_pkt_info *pkt, struct sk_buff *skb, struct rxe_pkt_info *pkt, struct sk_buff *skb,
int paylen) u32 paylen)
{ {
int err; int err;
...@@ -497,7 +497,7 @@ static void update_wqe_state(struct rxe_qp *qp, ...@@ -497,7 +497,7 @@ static void update_wqe_state(struct rxe_qp *qp,
static void update_wqe_psn(struct rxe_qp *qp, static void update_wqe_psn(struct rxe_qp *qp,
struct rxe_send_wqe *wqe, struct rxe_send_wqe *wqe,
struct rxe_pkt_info *pkt, struct rxe_pkt_info *pkt,
int payload) u32 payload)
{ {
/* number of packets left to send including current one */ /* number of packets left to send including current one */
int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu;
...@@ -540,7 +540,7 @@ static void rollback_state(struct rxe_send_wqe *wqe, ...@@ -540,7 +540,7 @@ static void rollback_state(struct rxe_send_wqe *wqe,
} }
static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
struct rxe_pkt_info *pkt, int payload) struct rxe_pkt_info *pkt, u32 payload)
{ {
qp->req.opcode = pkt->opcode; qp->req.opcode = pkt->opcode;
...@@ -612,7 +612,7 @@ int rxe_requester(void *arg) ...@@ -612,7 +612,7 @@ int rxe_requester(void *arg)
struct sk_buff *skb; struct sk_buff *skb;
struct rxe_send_wqe *wqe; struct rxe_send_wqe *wqe;
enum rxe_hdr_mask mask; enum rxe_hdr_mask mask;
int payload; u32 payload;
int mtu; int mtu;
int opcode; int opcode;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment