diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-04-29 16:19:02 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2007-04-29 16:19:02 -0400 |
commit | 11941a321d49cd2cafc8e64f66cbfed60fc1c691 (patch) | |
tree | 4a0055d4a3f4903565b159347ca06b64d5f20e67 /drivers/hid | |
parent | f61c9127b9840661244b1b6571e4304a7f0b5c73 (diff) | |
parent | 46386b587086c8d2698222a031bf749688464032 (diff) |
Merge branch 'field-zeroing' into for-linus
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 7c0fab1efb2e..e8387cb95d7f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -872,8 +872,13 @@ static void hid_output_field(struct hid_field *field, __u8 *data) | |||
872 | unsigned count = field->report_count; | 872 | unsigned count = field->report_count; |
873 | unsigned offset = field->report_offset; | 873 | unsigned offset = field->report_offset; |
874 | unsigned size = field->report_size; | 874 | unsigned size = field->report_size; |
875 | unsigned bitsused = offset + count * size; | ||
875 | unsigned n; | 876 | unsigned n; |
876 | 877 | ||
878 | /* make sure the unused bits in the last byte are zeros */ | ||
879 | if (count > 0 && size > 0 && (bitsused % 8) != 0) | ||
880 | data[(bitsused-1)/8] &= (1 << (bitsused % 8)) - 1; | ||
881 | |||
877 | for (n = 0; n < count; n++) { | 882 | for (n = 0; n < count; n++) { |
878 | if (field->logical_minimum < 0) /* signed values */ | 883 | if (field->logical_minimum < 0) /* signed values */ |
879 | implement(data, offset + n * size, size, s32ton(field->value[n], size)); | 884 | implement(data, offset + n * size, size, s32ton(field->value[n], size)); |