Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3
Commit:     c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3
Parent:     0887b4cb2102e281c123abf1408f218c15fd3ba3
Author:     Jiri Kosina <[EMAIL PROTECTED]>
AuthorDate: Fri Nov 30 11:12:58 2007 +0100
Committer:  Jiri Kosina <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:51:22 2008 +0100

    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 <[EMAIL PROTECTED]>
---
 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 2884b03..d73a768 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -26,6 +26,7 @@
 #include <linux/input.h>
 #include <linux/wait.h>
 #include <linux/vmalloc.h>
+#include <linux/sched.h>
 
 #include <linux/hid.h>
 #include <linux/hiddev.h>
@@ -758,7 +759,9 @@ static __inline__ __u32 extract(__u8 *report, unsigned 
offset, unsigned n)
 {
        u64 x;
 
-       WARN_ON(n > 32);
+       if (n > 32)
+               printk(KERN_WARNING "HID: extract() called with n (%d) > 32! 
(%s)\n",
+                               n, current->comm);
 
        report += offset >> 3;  /* adjust byte index */
        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
        __le64 x;
        u64 m = (1ULL << n) - 1;
 
-       WARN_ON(n > 32);
+       if (n > 32)
+               printk(KERN_WARNING "HID: implement() called with n (%d) > 32! 
(%s)\n",
+                               n, current->comm);
 
+       if (value > m)
+               printk(KERN_WARNING "HID: implement() called with too large 
value %d! (%s)\n",
+                               value, current->comm);
        WARN_ON(value > m);
        value &= m;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to