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)
commitbce1305c0ece3dc549663605e567655dd701752c
treecf38d31f01ec5c2be9e38b39245e2b6bcc908b7c
parentb7429ea53d6c0936a0f10a5d64164f0aea440143
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