Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77656
b: refs/heads/master
c: c4124c9
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Kosina committed Jan 28, 2008
1 parent ba32fdb commit 6af9002
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0887b4cb2102e281c123abf1408f218c15fd3ba3
refs/heads/master: c4124c9b68bf8ecf1e8afedad3a22e18666cb6f3
12 changes: 10 additions & 2 deletions trunk/drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 */
Expand All @@ -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;

Expand Down

0 comments on commit 6af9002

Please sign in to comment.