diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-11-30 05:12:58 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-01-28 08:51:22 -0500 |
commit | c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3 (patch) | |
tree | e94678db134f72037fa61ddf412bdeb98bf88de7 /drivers/hid/hid-core.c | |
parent | 0887b4cb2102e281c123abf1408f218c15fd3ba3 (diff) |
HID: remove redundant WARN_ON()s in order not to scare users
The WARN_ON() in implement() and extract() spit out stacktraces and
a lot of other information that might make users think that there is
something seriously wrong with the system. WARN_ON() should not be
deliberately triggerable by userspace application, which these can be.
Usually this WARN_ON() triggers when hid2hci utility is sending the
data that don't correspond to the device's report descriptor.
Convert these messages to more friendly printk().
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r-- | drivers/hid/hid-core.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 2884b036495a..d73a768e176e 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 | ||