Commit 4237081e authored by Jiri Kosina's avatar Jiri Kosina

HID: fix bug in zeroing the last field byte in output reports

d4ae650a introduced zeroing of the
last field byte in output reports in order to make sure the unused
bits are set to 0. This is done in a wrong way, resulting in a
wrong bits being zeroed out (not properly shifted by the field offset
in the report). Fix this.
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent fdc9c566
...@@ -880,7 +880,7 @@ static void hid_output_field(struct hid_field *field, __u8 *data) ...@@ -880,7 +880,7 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
/* make sure the unused bits in the last byte are zeros */ /* make sure the unused bits in the last byte are zeros */
if (count > 0 && size > 0) if (count > 0 && size > 0)
data[(count*size-1)/8] = 0; data[(offset+count*size-1)/8] = 0;
for (n = 0; n < count; n++) { for (n = 0; n < count; n++) {
if (field->logical_minimum < 0) /* signed values */ if (field->logical_minimum < 0) /* signed values */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment