public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 001/001] USB: ftdi_sio: fix endianess of max packet size
@ 2010-08-18 14:14 Michael Wileczka
  2010-08-19 21:46 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wileczka @ 2010-08-18 14:14 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-kernel

From: Michael Wileczka <mikewileczka@yahoo.com>

The USB max packet size (always little-endian) was not being byte swapped on big-endian systems.
Created with 2.6.32.16
Applicable since [USB: ftdi_sio: fix hi-speed device packet size calculation] approx 2.6.31

Signed-off-by: Michael Wileczka <mikewileczka@yahoo.com>
---
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1397,7 +1397,7 @@ static void ftdi_set_max_packet_size(str
 	}
 
 	/* set max packet size based on descriptor */
-	priv->max_packet_size = ep_desc->wMaxPacketSize;
+	priv->max_packet_size = le16_to_cpu(ep_desc->wMaxPacketSize);
 
 	dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
 }




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 001/001] USB: ftdi_sio: fix endianess of max packet size
  2010-08-18 14:14 [PATCH 001/001] USB: ftdi_sio: fix endianess of max packet size Michael Wileczka
@ 2010-08-19 21:46 ` Andrew Morton
  2010-08-19 23:01   ` Stephen Pape
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-08-19 21:46 UTC (permalink / raw)
  To: Michael Wileczka; +Cc: linux-usb, linux-kernel

On Wed, 18 Aug 2010 07:14:37 -0700 (PDT)
Michael Wileczka <mikewileczka@yahoo.com> wrote:

> From: Michael Wileczka <mikewileczka@yahoo.com>
> 
> The USB max packet size (always little-endian) was not being byte swapped on big-endian systems.
> Created with 2.6.32.16
> Applicable since [USB: ftdi_sio: fix hi-speed device packet size calculation] approx 2.6.31
> 
> Signed-off-by: Michael Wileczka <mikewileczka@yahoo.com>
> ---
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -1397,7 +1397,7 @@ static void ftdi_set_max_packet_size(str
>  	}
>  
>  	/* set max packet size based on descriptor */
> -	priv->max_packet_size = ep_desc->wMaxPacketSize;
> +	priv->max_packet_size = le16_to_cpu(ep_desc->wMaxPacketSize);
>  
>  	dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
>  }

So I guess nobody noticed this because the driver deosn't get used on
big-endian machines a lot?

What are the user-visible effects of this bug?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 001/001] USB: ftdi_sio: fix endianess of max packet size
  2010-08-19 21:46 ` Andrew Morton
@ 2010-08-19 23:01   ` Stephen Pape
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Pape @ 2010-08-19 23:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel

I guess you're right about it not being used very often on big endian machines.

The original bug report is here: https://dev.openwrt.org/ticket/7365

>From the user's point of view, priv->max_packet_size would get set to
0x0020 instead of 0x0200, so a message would print saying "Setting
MaxPacketSize 2" when it should be 512. After that you couldn't get
any data from the serial port, because priv->max_packet_size is used
in other sections of the code.

-Stephen

On Thu, Aug 19, 2010 at 5:46 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> On Wed, 18 Aug 2010 07:14:37 -0700 (PDT)
> Michael Wileczka <mikewileczka@yahoo.com> wrote:
>
> > From: Michael Wileczka <mikewileczka@yahoo.com>
> >
> > The USB max packet size (always little-endian) was not being byte swapped on big-endian systems.
> > Created with 2.6.32.16
> > Applicable since [USB: ftdi_sio: fix hi-speed device packet size calculation] approx 2.6.31
> >
> > Signed-off-by: Michael Wileczka <mikewileczka@yahoo.com>
> > ---
> > --- a/drivers/usb/serial/ftdi_sio.c
> > +++ b/drivers/usb/serial/ftdi_sio.c
> > @@ -1397,7 +1397,7 @@ static void ftdi_set_max_packet_size(str
> >       }
> >
> >       /* set max packet size based on descriptor */
> > -     priv->max_packet_size = ep_desc->wMaxPacketSize;
> > +     priv->max_packet_size = le16_to_cpu(ep_desc->wMaxPacketSize);
> >
> >       dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
> >  }
>
> So I guess nobody noticed this because the driver deosn't get used on
> big-endian machines a lot?
>
> What are the user-visible effects of this bug?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-19 23:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 14:14 [PATCH 001/001] USB: ftdi_sio: fix endianess of max packet size Michael Wileczka
2010-08-19 21:46 ` Andrew Morton
2010-08-19 23:01   ` Stephen Pape

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox