Re: Unaligned access in EHCI driver

Pete Zaitcev <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Red Hat, Inc.
Message-ID <[email protected]>
On Fri, 2 Mar 2007 10:22:03 +0300, "Max Dmitrichenko" <[email protected]> wrote:

> If I understand write, the only place from which the ehci_hub_control
> is called is function rh_call_control(). But it passes a pointer to
> the buffer allocated on the stack with __attribute__((aligned(4))).
> That way no SLAB is involved.

Hilarous! Afraid that attribute lovers won't take the right lesson
from it, however. I know how stubborn and obstinate they are.

Please try the attached.

-- Pete

--- linux-2.6.20-rc2/drivers/usb/core/hcd.c	2006-12-30 21:02:53.000000000 -0800
+++ linux-2.6.20-rc2-mon/drivers/usb/core/hcd.c	2007-03-02 09:41:19.000000000 -0800
@@ -347,9 +347,12 @@
 	struct usb_ctrlrequest *cmd;
  	u16		typeReq, wValue, wIndex, wLength;
 	u8		*ubuf = urb->transfer_buffer;
-	u8		tbuf [sizeof (struct usb_hub_descriptor)]
-		__attribute__((aligned(4)));
-	const u8	*bufp = tbuf;
+	union {
+		int aligner;
+		u8 c[sizeof (struct usb_hub_descriptor)];
+	} buf;
+	const u8	*bufp = buf.c;
+	u8 		*tbuf = buf.c;
 	int		len = 0;
 	int		patch_wakeup = 0;
 	unsigned long	flags;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.