mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jules Maselbas <jmaselbas@kalray.eu>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/6] usb: string: Use le16_to_cpu for langid
Date: Mon, 14 Oct 2019 13:42:48 +0200	[thread overview]
Message-ID: <20191014114248.o2k4wsbuumqwbnaj@pengutronix.de> (raw)
In-Reply-To: <20191010081503.15254-4-jmaselbas@kalray.eu>

On Thu, Oct 10, 2019 at 10:15:01AM +0200, Jules Maselbas wrote:
> This might fix an endianness bug when the cpu is big-endian
> as the string_langid will be converted with `cpu_to_le16` when
> sending a control message to get a string descriptor.
> 
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  drivers/usb/core/usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> index e14b89b5e..5dc7993ac 100644
> --- a/drivers/usb/core/usb.c
> +++ b/drivers/usb/core/usb.c
> @@ -925,7 +925,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
>  			goto error;
>  		} else {
>  			dev->have_langid = -1;
> -			dev->string_langid = tbuf[2] | (tbuf[3] << 8);
> +			dev->string_langid = le16_to_cpu(*((__le16 *)&buf[2]));

You also changed from tbuf to buf. Is this intentional?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-10-14 11:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  8:14 [PATCH 1/6] usb: hub: Use more accurate struct name Jules Maselbas
2019-10-10  8:14 ` [PATCH 2/6] usb: hub: Only clear port reset status if set Jules Maselbas
2019-10-10  8:15 ` [PATCH 3/6] usb: string: Use dma_alloc instead of a local buffer Jules Maselbas
2019-10-10  8:15 ` [PATCH 4/6] usb: string: Use le16_to_cpu for langid Jules Maselbas
2019-10-10 20:41   ` Andrey Smirnov
2019-10-14 11:42   ` Sascha Hauer [this message]
2019-10-14 15:09     ` Jules Maselbas
2019-10-10  8:15 ` [PATCH 5/6] usb: string: size_t is unsigned Jules Maselbas
2019-10-10  8:15 ` [PATCH 6/6] usb: string: Minor changes Jules Maselbas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191014114248.o2k4wsbuumqwbnaj@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jmaselbas@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox