diff mbox

[RESEND] usb-ohci: Fix endianness issue

Message ID 200912231652.36165.mb@bu3sch.de
State New
Headers show

Commit Message

Michael Buesch Dec. 23, 2009, 3:52 p.m. UTC
This fixes a possible endianness issue in the usb-ohci hw module.
hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

Resend. This patch was already sent on 2009/07/08, but the problem is still present in trunk.

---
 hw/usb-ohci.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Aurelien Jarno Dec. 23, 2009, 10:43 p.m. UTC | #1
On Wed, Dec 23, 2009 at 04:52:34PM +0100, Michael Buesch wrote:
> This fixes a possible endianness issue in the usb-ohci hw module.
> hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().
> 
> Signed-off-by: Michael Buesch <mb@bu3sch.de>
> 
> ---
> 
> Resend. This patch was already sent on 2009/07/08, but the problem is still present in trunk.

It has already been applied long time ago:

commit 1fa63e43e64596455938e09d3e6ec89eb0c4bbc8
Author: Michael Buesch <mb@bu3sch.de>
Date:   Wed Jul 8 21:54:28 2009 +0200

    usb-ohci: Fix endianness issue

    This fixes a possible endianness issue in the usb-ohci hw module.
    hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().

    Signed-off-by: Michael Buesch <mb@bu3sch.de>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


> ---
>  hw/usb-ohci.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- trunk.orig/hw/usb-ohci.c
> +++ trunk/hw/usb-ohci.c
> @@ -1150,9 +1150,9 @@ static void ohci_frame_boundary(void *op
>      /* Frame boundary, so do EOF stuf here */
>      ohci->frt = ohci->fit;
>  
> -    /* XXX: endianness */
> +    /* Increment frame number and take care of endianness. */
>      ohci->frame_number = (ohci->frame_number + 1) & 0xffff;
> -    hcca.frame = cpu_to_le32(ohci->frame_number);
> +    hcca.frame = cpu_to_le16(ohci->frame_number);
>  
>      if (ohci->done_count == 0 && !(ohci->intr_status & OHCI_INTR_WD)) {
>          if (!ohci->done)
> 
> -- 
> Greetings, Michael.
> 
> 
>
Michael Buesch Dec. 23, 2009, 11:22 p.m. UTC | #2
On Wednesday 23 December 2009 23:43:44 Aurelien Jarno wrote:
> It has already been applied long time ago:

Is svn://svn.savannah.nongnu.org/qemu/trunk not used anymore?
Aurelien Jarno Dec. 23, 2009, 11:25 p.m. UTC | #3
On Thu, Dec 24, 2009 at 12:22:00AM +0100, Michael Buesch wrote:
> On Wednesday 23 December 2009 23:43:44 Aurelien Jarno wrote:
> > It has already been applied long time ago:
> 
> Is svn://svn.savannah.nongnu.org/qemu/trunk not used anymore?
> 

No, you should use instead:

git://git.savannah.nongnu.org/qemu.git
diff mbox

Patch

--- trunk.orig/hw/usb-ohci.c
+++ trunk/hw/usb-ohci.c
@@ -1150,9 +1150,9 @@  static void ohci_frame_boundary(void *op
     /* Frame boundary, so do EOF stuf here */
     ohci->frt = ohci->fit;
 
-    /* XXX: endianness */
+    /* Increment frame number and take care of endianness. */
     ohci->frame_number = (ohci->frame_number + 1) & 0xffff;
-    hcca.frame = cpu_to_le32(ohci->frame_number);
+    hcca.frame = cpu_to_le16(ohci->frame_number);
 
     if (ohci->done_count == 0 && !(ohci->intr_status & OHCI_INTR_WD)) {
         if (!ohci->done)