• David Brownell's avatar
    USB: usb gadgets avoid le{16,32}_to_cpup() · 01ee7d70
    David Brownell authored
    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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    01ee7d70
rndis.c 36.8 KB