aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2884b036495..d73a768e176 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -26,6 +26,7 @@
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29#include <linux/sched.h>
29 30
30#include <linux/hid.h> 31#include <linux/hid.h>
31#include <linux/hiddev.h> 32#include <linux/hiddev.h>
@@ -758,7 +759,9 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
758{ 759{
759 u64 x; 760 u64 x;
760 761
761 WARN_ON(n > 32); 762 if (n > 32)
763 printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n",
764 n, current->comm);
762 765
763 report += offset >> 3; /* adjust byte index */ 766 report += offset >> 3; /* adjust byte index */
764 offset &= 7; /* now only need bit offset into one byte */ 767 offset &= 7; /* now only need bit offset into one byte */
@@ -780,8 +783,13 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3
780 __le64 x; 783 __le64 x;
781 u64 m = (1ULL << n) - 1; 784 u64 m = (1ULL << n) - 1;
782 785
783 WARN_ON(n > 32); 786 if (n > 32)
787 printk(KERN_WARNING "HID: implement() called with n (%d) > 32! (%s)\n",
788 n, current->comm);
784 789
790 if (value > m)
791 printk(KERN_WARNING "HID: implement() called with too large value %d! (%s)\n",
792 value, current->comm);
785 WARN_ON(value > m); 793 WARN_ON(value > m);
786 value &= m; 794 value &= m;
787 795