lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUSxg6LfUsib1P45@kroah.com>
Date:   Fri, 17 Sep 2021 17:17:23 +0200
From:   'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>
To:     David Laight <David.Laight@...lab.com>
Cc:     "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
        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}()

On Fri, Sep 17, 2021 at 03:01:27PM +0000, David Laight wrote:
> 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.

Yes it was a problem, which is why the USB core function called here
does not require that and makes sure to allocate the buffer itself so
that all will be fine.

> 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.

USB speeds are slow you will never notice the difference for control
messages.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ