[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0331c99f809449e88e5e5be9311aa5a9@AcuMS.aculab.com>
Date: Fri, 17 Sep 2021 15:01:27 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>
CC: Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Pavel Skripkin <paskripkin@...il.com>,
"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: RE: [PATCH v7 17/19] staging: r8188eu: shorten calls chain of
rtw_read{8,16,32}()
From: Greg Kroah-Hartman
> Sent: 17 September 2021 15:50
...
> > +static int usb_read(struct intf_hdl *intfhdl, u16 addr, void *data, u8 size)
> > +{
> > + struct adapter *adapt = intfhdl->padapter;
> > + struct dvobj_priv *dvobjpriv = adapter_to_dvobj(adapt);
> > + struct usb_device *udev = dvobjpriv->pusbdev;
> > + int status;
> > + u8 *io_buf; /* Pointer to I/O buffer */
>
> As you "know" size is not going to be larger than 4 (hint, you should
> prboably check it), just use bytes off of the stack here, and you can
> ignore this buffer entirely. That will hopefully allow you in the
> future to get rid of that buffer as odds are it will not be needed
> anymore.
Isn't that likely to be the buffer that gets dma'd to/from?
In which case it can't be on-stack.
Certainly that is a common problem with usb drivers.
Give the size of the urb? structure allocated for each transfer
adding a bounce buffer area in it for short transfers would
surely be sane.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists