Message ID | 20220302141054.2078616-1-cgxu519@mykernel.net (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Leon Romanovsky |
Headers | show |
Series | RDMA/rxe: change payload type to u32 from int | expand |
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 > >
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 > >
在 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 >> >>
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 > > > > > > > >
在 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
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;
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(-)