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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
97cb95d1c4
commit
01ee7d7032
@ -1651,9 +1651,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
|
||||
UDC_EP_NUM_REG = 0;
|
||||
} while (UDC_IRQ_SRC_REG & UDC_SETUP);
|
||||
|
||||
#define w_value le16_to_cpup (&u.r.wValue)
|
||||
#define w_index le16_to_cpup (&u.r.wIndex)
|
||||
#define w_length le16_to_cpup (&u.r.wLength)
|
||||
#define w_value le16_to_cpu(u.r.wValue)
|
||||
#define w_index le16_to_cpu(u.r.wIndex)
|
||||
#define w_length le16_to_cpu(u.r.wLength)
|
||||
|
||||
/* Delegate almost all control requests to the gadget driver,
|
||||
* except for a handful of ch9 status/feature requests that
|
||||
|
Reference in New Issue
Block a user