All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/rxe: change payload type to u32 from int
@ 2022-03-02 14:10 Chengguang Xu
  2022-03-03  2:26 ` Zhu Yanjun
  2022-03-03 18:04 ` Leon Romanovsky
  0 siblings, 2 replies; 6+ messages in thread
From: Chengguang Xu @ 2022-03-02 14:10 UTC (permalink / raw)
  To: zyjzyj2000, jgg; +Cc: linux-rdma, Chengguang Xu

The type of wqe length is u32 so change variable payload
to type u32 to avoid overflow on large wqe length.

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

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

* Re: [PATCH] RDMA/rxe: change payload type to u32 from int
  2022-03-02 14:10 [PATCH] RDMA/rxe: change payload type to u32 from int Chengguang Xu
@ 2022-03-03  2:26 ` Zhu Yanjun
  2022-03-03 18:04 ` Leon Romanovsky
  1 sibling, 0 replies; 6+ messages in thread
From: Zhu Yanjun @ 2022-03-03  2:26 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Jason Gunthorpe, RDMA mailing list

On Wed, Mar 2, 2022 at 10:11 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
>
> The type of wqe length is u32 so change variable payload
> to type u32 to avoid overflow on large wqe length.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

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

Zhu Yanjun

> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
> index 5eb89052dd66..e989ee3a2033 100644
> --- a/drivers/infiniband/sw/rxe/rxe_req.c
> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
> @@ -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	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/rxe: change payload type to u32 from int
  2022-03-02 14:10 [PATCH] RDMA/rxe: change payload type to u32 from int Chengguang Xu
  2022-03-03  2:26 ` Zhu Yanjun
@ 2022-03-03 18:04 ` Leon Romanovsky
  2022-03-04  2:08   ` Chengguang Xu
  1 sibling, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2022-03-03 18:04 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: zyjzyj2000, jgg, linux-rdma

On Wed, Mar 02, 2022 at 10:10:54PM +0800, Chengguang Xu wrote:
> The type of wqe length is u32 so change variable payload
> to type u32 to avoid overflow on large wqe length.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> ---
>  drivers/infiniband/sw/rxe/rxe_req.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
> index 5eb89052dd66..e989ee3a2033 100644
> --- a/drivers/infiniband/sw/rxe/rxe_req.c
> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
> @@ -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;

This change is not complete, functions in rxe_requester() that receive
payload as an input should be changed too.

>  	int mtu;
>  	int opcode;
>  	int ret;
> -- 
> 2.27.0
> 
> 

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

* Re: [PATCH] RDMA/rxe: change payload type to u32 from int
  2022-03-03 18:04 ` Leon Romanovsky
@ 2022-03-04  2:08   ` Chengguang Xu
  2022-03-04  7:10     ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Chengguang Xu @ 2022-03-04  2:08 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: zyjzyj2000, jgg, linux-rdma

在 2022/3/4 2:04, Leon Romanovsky 写道:
> On Wed, Mar 02, 2022 at 10:10:54PM +0800, Chengguang Xu wrote:
>> The type of wqe length is u32 so change variable payload
>> to type u32 to avoid overflow on large wqe length.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>> ---
>>   drivers/infiniband/sw/rxe/rxe_req.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
>> index 5eb89052dd66..e989ee3a2033 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_req.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
>> @@ -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;
> This change is not complete, functions in rxe_requester() that receive
> payload as an input should be changed too.

IIUC, when calling those functions payload has been cut off to mtu size
and I think mtu will be much smaller than 2GB, so there is no rish of 
overflow.

Thanks,
Chengguang

>
>>   	int mtu;
>>   	int opcode;
>>   	int ret;
>> -- 
>> 2.27.0
>>
>>



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

* Re: [PATCH] RDMA/rxe: change payload type to u32 from int
  2022-03-04  2:08   ` Chengguang Xu
@ 2022-03-04  7:10     ` Leon Romanovsky
  2022-03-04  7:20       ` Chengguang Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2022-03-04  7:10 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: zyjzyj2000, jgg, linux-rdma

On Fri, Mar 04, 2022 at 10:08:29AM +0800, Chengguang Xu wrote:
> 在 2022/3/4 2:04, Leon Romanovsky 写道:
> > On Wed, Mar 02, 2022 at 10:10:54PM +0800, Chengguang Xu wrote:
> > > The type of wqe length is u32 so change variable payload
> > > to type u32 to avoid overflow on large wqe length.
> > > 
> > > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> > > ---
> > >   drivers/infiniband/sw/rxe/rxe_req.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
> > > index 5eb89052dd66..e989ee3a2033 100644
> > > --- a/drivers/infiniband/sw/rxe/rxe_req.c
> > > +++ b/drivers/infiniband/sw/rxe/rxe_req.c
> > > @@ -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;
> > This change is not complete, functions in rxe_requester() that receive
> > payload as an input should be changed too.
> 
> IIUC, when calling those functions payload has been cut off to mtu size
> and I think mtu will be much smaller than 2GB, so there is no rish of
> overflow.

It is not because of overflow, but desire to have proper types for whole
call stack without shadow casting and ambiguity.

Thanks

> 
> Thanks,
> Chengguang
> 
> > 
> > >   	int mtu;
> > >   	int opcode;
> > >   	int ret;
> > > -- 
> > > 2.27.0
> > > 
> > > 
> 
> 

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

* Re: [PATCH] RDMA/rxe: change payload type to u32 from int
  2022-03-04  7:10     ` Leon Romanovsky
@ 2022-03-04  7:20       ` Chengguang Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Chengguang Xu @ 2022-03-04  7:20 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: zyjzyj2000, jgg, linux-rdma

在 2022/3/4 15:10, Leon Romanovsky 写道:
> On Fri, Mar 04, 2022 at 10:08:29AM +0800, Chengguang Xu wrote:
>> 在 2022/3/4 2:04, Leon Romanovsky 写道:
>>> On Wed, Mar 02, 2022 at 10:10:54PM +0800, Chengguang Xu wrote:
>>>> The type of wqe length is u32 so change variable payload
>>>> to type u32 to avoid overflow on large wqe length.
>>>>
>>>> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>>>> ---
>>>>    drivers/infiniband/sw/rxe/rxe_req.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
>>>> index 5eb89052dd66..e989ee3a2033 100644
>>>> --- a/drivers/infiniband/sw/rxe/rxe_req.c
>>>> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
>>>> @@ -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;
>>> This change is not complete, functions in rxe_requester() that receive
>>> payload as an input should be changed too.
>> IIUC, when calling those functions payload has been cut off to mtu size
>> and I think mtu will be much smaller than 2GB, so there is no rish of
>> overflow.
> It is not because of overflow, but desire to have proper types for whole
> call stack without shadow casting and ambiguity.

Okay, that makes sense, let me fold into v2 version.


Thanks,
Chengguang






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

end of thread, other threads:[~2022-03-04  7:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 14:10 [PATCH] RDMA/rxe: change payload type to u32 from int Chengguang Xu
2022-03-03  2:26 ` Zhu Yanjun
2022-03-03 18:04 ` Leon Romanovsky
2022-03-04  2:08   ` Chengguang Xu
2022-03-04  7:10     ` Leon Romanovsky
2022-03-04  7:20       ` Chengguang Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.