Input: HID items of width 32 (bits) or greater are incorrectly extracted
authorAdam Kropelin <akropel1@rochester.rr.com>
Sun, 29 May 2005 07:30:08 +0000 (02:30 -0500)
committerDmitry Torokhov <dtor_core@ameritech.net>
Sun, 29 May 2005 07:30:08 +0000 (02:30 -0500)
       due to a masking bug in hid-core.c:extract(). This patch fixes it
       up by forcing the mask to be 64 bits wide.

Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>
Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/usb/input/hid-core.c

index 08e701b..43215a9 100644 (file)
@@ -765,7 +765,7 @@ static __inline__ __u32 s32ton(__s32 value, unsigned n)
 static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
 {
        report += (offset >> 5) << 2; offset &= 31;
-       return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1 << n) - 1);
+       return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1ULL << n) - 1);
 }
 
 static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value)