linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type
@ 2022-03-07 14:50 Chengguang Xu
  2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chengguang Xu @ 2022-03-07 14:50 UTC (permalink / raw)
  To: zyjzyj2000, jgg; +Cc: leon, linux-rdma, Chengguang Xu

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.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 5eb89052dd66..b28036a7a3b8 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -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);
@@ -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;
 
@@ -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;
@@ -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;
 
@@ -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;
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state()
  2022-03-07 14:50 [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Chengguang Xu
@ 2022-03-07 14:50 ` Chengguang Xu
  2022-03-09 13:34   ` Leon Romanovsky
  2022-03-10  2:32   ` Zhu Yanjun
  2022-03-09 13:34 ` [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Leon Romanovsky
  2022-03-14 23:44 ` Jason Gunthorpe
  2 siblings, 2 replies; 6+ messages in thread
From: Chengguang Xu @ 2022-03-07 14:50 UTC (permalink / raw)
  To: zyjzyj2000, jgg; +Cc: leon, linux-rdma, Chengguang Xu

The argument 'payload' is not used in update_state(),
so just remove it.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 drivers/infiniband/sw/rxe/rxe_req.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index b28036a7a3b8..a3c78b4ac9f1 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -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, u32 payload)
+			 struct rxe_pkt_info *pkt)
 {
 	qp->req.opcode = pkt->opcode;
 
@@ -747,7 +747,7 @@ int rxe_requester(void *arg)
 		goto err;
 	}
 
-	update_state(qp, wqe, &pkt, payload);
+	update_state(qp, wqe, &pkt);
 
 	goto next_wqe;
 
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type
  2022-03-07 14:50 [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Chengguang Xu
  2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
@ 2022-03-09 13:34 ` Leon Romanovsky
  2022-03-14 23:44 ` Jason Gunthorpe
  2 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2022-03-09 13:34 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: zyjzyj2000, jgg, linux-rdma

On Mon, Mar 07, 2022 at 10:50:46PM +0800, Chengguang Xu wrote:
> 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.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state()
  2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
@ 2022-03-09 13:34   ` Leon Romanovsky
  2022-03-10  2:32   ` Zhu Yanjun
  1 sibling, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2022-03-09 13:34 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: zyjzyj2000, jgg, linux-rdma

On Mon, Mar 07, 2022 at 10:50:47PM +0800, Chengguang Xu wrote:
> The argument 'payload' is not used in update_state(),
> so just remove it.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state()
  2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
  2022-03-09 13:34   ` Leon Romanovsky
@ 2022-03-10  2:32   ` Zhu Yanjun
  1 sibling, 0 replies; 6+ messages in thread
From: Zhu Yanjun @ 2022-03-10  2:32 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Jason Gunthorpe, Leon Romanovsky, RDMA mailing list

On Mon, Mar 7, 2022 at 10:51 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
>
> The argument 'payload' is not used in update_state(),
> so just remove it.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>

Zhu Yanjun

> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
> index b28036a7a3b8..a3c78b4ac9f1 100644
> --- a/drivers/infiniband/sw/rxe/rxe_req.c
> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
> @@ -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, u32 payload)
> +                        struct rxe_pkt_info *pkt)
>  {
>         qp->req.opcode = pkt->opcode;
>
> @@ -747,7 +747,7 @@ int rxe_requester(void *arg)
>                 goto err;
>         }
>
> -       update_state(qp, wqe, &pkt, payload);
> +       update_state(qp, wqe, &pkt);
>
>         goto next_wqe;
>
> --
> 2.27.0
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type
  2022-03-07 14:50 [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Chengguang Xu
  2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
  2022-03-09 13:34 ` [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Leon Romanovsky
@ 2022-03-14 23:44 ` Jason Gunthorpe
  2 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2022-03-14 23:44 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: zyjzyj2000, leon, linux-rdma

On Mon, Mar 07, 2022 at 10:50:46PM +0800, Chengguang Xu wrote:
> 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.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Both patches applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-14 23:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 14:50 [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Chengguang Xu
2022-03-07 14:50 ` [PATCH v2 2/2] RDMA/rxe: remove useless argument for update_state() Chengguang Xu
2022-03-09 13:34   ` Leon Romanovsky
2022-03-10  2:32   ` Zhu Yanjun
2022-03-09 13:34 ` [PATCH v2 1/2] RDMA/rxe: change variable and function argument to proper type Leon Romanovsky
2022-03-14 23:44 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).