diff options
author | Julius Werner <jwerner@chromium.org> | 2018-02-14 16:42:47 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2018-02-16 00:08:26 +0000 |
commit | 3faa2c802eaa1ab06c2817af1e234fd839a543c4 (patch) | |
tree | 7684b655c7e7b67c5fa4f2997625e75f6487f6dc /util/nvramtool/cmos_ops.h | |
parent | 9ec6928b8c7bfdd3bed4eb233672e74f6914ebb6 (diff) |
libpayload: usbhid: Zero-initialize all parts of usbhid instance struct
The USBHID driver zero-initializes some but not all of the fields in its
usbhid_inst_t structure. This is a problem because under some
circumstances, some of the uninitialized fields may be read and lead to
incorrect behavior. Some (broken) USB keyboards keep sending reports
that contain all zeroes even when they have no new keys... these usually
get silently ignored, but if the usbhid_inst_t structure is in an
inconsistent state where 'previous' is zeroed out but 'lastkeypress'
is non-zero because it wasn't properly initialized, these reports will
be interpreted as keyrepeats of the bogus 'lastkeypress'. This patch
changes the code to just xzalloc() the whole structure so we won't have
to worry about initialization issues anymore.
Change-Id: Ic987de2daaceaad2ae401a1e12b1bee397f802ee
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/23766
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'util/nvramtool/cmos_ops.h')
0 files changed, 0 insertions, 0 deletions