]> git.baikalelectronics.ru Git - kernel.git/commit
USB: usb gadgets avoid le{16,32}_to_cpup()
authorDavid Brownell <david-b@pacbell.net>
Sat, 26 May 2007 03:40:14 +0000 (20:40 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Jun 2007 23:24:30 +0000 (16:24 -0700)
commitb8d9790b88de39b88b8de3e6d09759a9f5fe56c2
tree2a5681e94df6ee18287a962394e9e8565e27f5bc
parentff9e492fdcddab86c0788285075ef3dae4c5280e
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>
drivers/usb/gadget/epautoconf.c
drivers/usb/gadget/inode.c
drivers/usb/gadget/net2280.c
drivers/usb/gadget/omap_udc.c
drivers/usb/gadget/rndis.c