RE: [PATCH 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

Long Li
2022-05-19T17:51:58Z

> Subject: Re: [PATCH 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure
> Network Adapter
>
> On Thu, May 19, 2022 at 05:57:01AM +0000, Long Li wrote:
>
> > > > +
> > > > + err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd),
> > > > +udata->inlen));
> > >
> > > Skeptical this min is correct, many other drivers get this wrong.
> >
> > I think this is correct. This is to prevent user-mode passing more data that may
> overrun the kernel buffer.
>
> And what happens when udata->inlen is, say, 0?

Thanks. I'll add check before calling ib_copy_from_udata().

Long