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]
Date:   Thu, 17 Oct 2019 02:18:47 +0000
From:   Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
To:     Simon Horman <horms@...ge.net.au>
CC:     "linux-kernel@...ts.codethink.co.uk" 
        <linux-kernel@...ts.codethink.co.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Ben Dooks (Codethink)" <ben.dooks@...ethink.co.uk>
Subject: RE: [PATCH] usb: renesas_usbhs: fix __le16 warnings

Hi Simon-san,

> From: Simon Horman, Sent: Wednesday, October 16, 2019 9:27 PM
<snip>
> > diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
> > index 4c3de777ef6c..a3c30b609433 100644
> > --- a/drivers/usb/renesas_usbhs/common.c
> > +++ b/drivers/usb/renesas_usbhs/common.c
> > @@ -162,17 +162,17 @@ void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
> >  	req->bRequest		= (val >> 8) & 0xFF;
> >  	req->bRequestType	= (val >> 0) & 0xFF;
> >
> > -	req->wValue	= usbhs_read(priv, USBVAL);
> > -	req->wIndex	= usbhs_read(priv, USBINDX);
> > -	req->wLength	= usbhs_read(priv, USBLENG);
> > +	req->wValue	= cpu_to_le16(usbhs_read(priv, USBVAL));
> > +	req->wIndex	= cpu_to_le16(usbhs_read(priv, USBINDX));
> > +	req->wLength	= cpu_to_le16(usbhs_read(priv, USBLENG));
> 
> usbhs_read is backed by readl which performs
> a le->cpu conversion. Rather than have a double conversion
> perhaps it would be nicer to introduce usbhs_read_le.
> Likewise for write.

I'm afraid but, I could not understand these comments.
At the moment, the usbhs_{read,write}() call io{read,write}16(),
not {read,write}l().

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/renesas_usbhs/common.c?h=v5.4-rc3#n62

Best regards,
Yoshihiro Shimoda

> 
> >  }
> >
> >  void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
> >  {
> >  	usbhs_write(priv, USBREQ,  (req->bRequest << 8) | req->bRequestType);
> > -	usbhs_write(priv, USBVAL,  req->wValue);
> > -	usbhs_write(priv, USBINDX, req->wIndex);
> > -	usbhs_write(priv, USBLENG, req->wLength);
> > +	usbhs_write(priv, USBVAL,  le16_to_cpu(req->wValue));
> > +	usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex));
> > +	usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength));
> >
> >  	usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
> >  }
> > --
> > 2.23.0
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ