]> git.baikalelectronics.ru Git - kernel.git/commit
HID: core: Correctly handle ReportSize being zero
authorMarc Zyngier <maz@kernel.org>
Sat, 29 Aug 2020 11:26:01 +0000 (12:26 +0100)
committerBenjamin Tissoires <benjamin.tissoires@gmail.com>
Tue, 1 Sep 2020 08:25:49 +0000 (10:25 +0200)
commit36a1d2e4bd700a2745d98712751ce178bd31e9d0
treecf38d31f01ec5c2be9e38b39245e2b6bcc908b7c
parent23390174ef11ed6a09e31e633162d9c22d03bbf7
HID: core: Correctly handle ReportSize being zero

It appears that a ReportSize value of zero is legal, even if a bit
non-sensical. Most of the HID code seems to handle that gracefully,
except when computing the total size in bytes. When fed as input to
memset, this leads to some funky outcomes.

Detect the corner case and correctly compute the size.

Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
drivers/hid/hid-core.c