From cff79d9ed342e6b11ad33ba1f254c3fc5614c0b3 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 16 May 2012 17:51:56 +0000 Subject: [PATCH] HID Report ID is unsigned value, so clear the rest of bits from possible sign expansion. --- lib/libusbhid/parse.c | 2 +- sys/dev/usb/usb_hid.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libusbhid/parse.c b/lib/libusbhid/parse.c index f7c2cb195be1..041e28999991 100644 --- a/lib/libusbhid/parse.c +++ b/lib/libusbhid/parse.c @@ -392,7 +392,7 @@ hid_get_item(hid_data_t s, hid_item_t *h) s->loc_size = dval & mask; break; case 8: - hid_switch_rid(s, c, dval); + hid_switch_rid(s, c, dval & mask); break; case 9: /* mask because value is unsigned */ diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c index 165919bc6622..6552546d2507 100644 --- a/sys/dev/usb/usb_hid.c +++ b/sys/dev/usb/usb_hid.c @@ -425,7 +425,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h) s->loc_size = dval & mask; break; case 8: - hid_switch_rid(s, c, dval); + hid_switch_rid(s, c, dval & mask); break; case 9: /* mask because value is unsigned */