Re: [PATCH] RDMA/rxe: change payload type to u32 from int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> > > ---
> > >   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
> > > 
> > > 
> 
> 



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux