aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/epautoconf.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-25 23:40:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-06-08 19:24:30 -0400
commit01ee7d7032204b383b2fba73021e7acbc776184b (patch)
tree2a5681e94df6ee18287a962394e9e8565e27f5bc /drivers/usb/gadget/epautoconf.c
parent97cb95d1c4b724bc3bedd16dd022fbd3c2d61283 (diff)
USB: usb gadgets avoid le{16,32}_to_cpup()
It turns out that le16_to_cpup() and le32_to_cpup() aren't always safe to call with pointers into packed structures, since those are inlined functions and GCC may lose the "packed" attribute. So those references can become unaligned kernel accesses, which are evil on some hardware. This patch updates uses of those routines in the gadget stack. The references into packed structures can just use leXX_to_cpu(*x), which in most cases is more natural. Some other uses in RNDIS, mostly in debug code, were wrong in the first place; those use get_unaligned(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/epautoconf.c')
-rw-r--r--drivers/usb/gadget/epautoconf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index f28af06905a5..6042364402b8 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -132,7 +132,7 @@ ep_matches (
132 * where it's an output parameter representing the full speed limit. 132 * where it's an output parameter representing the full speed limit.
133 * the usb spec fixes high speed bulk maxpacket at 512 bytes. 133 * the usb spec fixes high speed bulk maxpacket at 512 bytes.
134 */ 134 */
135 max = 0x7ff & le16_to_cpup (&desc->wMaxPacketSize); 135 max = 0x7ff & le16_to_cpu(desc->wMaxPacketSize);
136 switch (type) { 136 switch (type) {
137 case USB_ENDPOINT_XFER_INT: 137 case USB_ENDPOINT_XFER_INT:
138 /* INT: limit 64 bytes full speed, 1024 high speed */ 138 /* INT: limit 64 bytes full speed, 1024 high speed */