Skip to content

Commit

Permalink
RDMA/rxe: Change variable and function argument to proper type
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Chengguang Xu <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
cgxu519 authored and jgunthorpe committed Mar 14, 2022
1 parent 6f6dbb8 commit 7e8e611
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/infiniband/sw/rxe/rxe_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static inline int get_mtu(struct rxe_qp *qp)

static struct sk_buff *init_req_packet(struct rxe_qp *qp,
struct rxe_send_wqe *wqe,
int opcode, int payload,
int opcode, u32 payload,
struct rxe_pkt_info *pkt)
{
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
Expand Down Expand Up @@ -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,
struct rxe_pkt_info *pkt, struct sk_buff *skb,
int paylen)
u32 paylen)
{
int err;

Expand Down Expand Up @@ -497,7 +497,7 @@ static void update_wqe_state(struct rxe_qp *qp,
static void update_wqe_psn(struct rxe_qp *qp,
struct rxe_send_wqe *wqe,
struct rxe_pkt_info *pkt,
int payload)
u32 payload)
{
/* number of packets left to send including current one */
int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu;
Expand Down Expand Up @@ -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,
struct rxe_pkt_info *pkt, int payload)
struct rxe_pkt_info *pkt, u32 payload)
{
qp->req.opcode = pkt->opcode;

Expand Down Expand Up @@ -612,7 +612,7 @@ int rxe_requester(void *arg)
struct sk_buff *skb;
struct rxe_send_wqe *wqe;
enum rxe_hdr_mask mask;
int payload;
u32 payload;
int mtu;
int opcode;
int ret;
Expand Down

0 comments on commit 7e8e611

Please sign in to comment.