Skip to content
Commit 75c28df8 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by Jiri Kosina
Browse files

HID: non-overlapping zeroing of extra bits



From my review of the way the unused bits of report are being zeroed,
it seems like there must be a bug. Currently, the zeroing is done
in hid_output_field and it covers any bits between the last used bit
and the end of the byte. But in case of, say, my keyboard, NumLock is
mask 0x01 and CapsLock is 0x02. Invoking hid_output_field for NumLock
definitely zeroes across CapsLock. The only reason this works is that
the fields are sorted by the offset.

It would be more correct and simpler to zero-fill the buffer into
which the fields are set.

The patch is tested with an IBM keyboard that is improperly sensitive
to out-of-report pad bits, the extra bits are still zeroed and the
fields continue to work as expected. It is also tested with good
keyboards.

In case, a related bug in RHEL 5 is tracked with Red Hat bug 513934.

Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 6dec143a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment