]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
HID: hid-sensor-hub: clear memory to avoid random data
authorSong Hongyan <hongyan.song@intel.com>
Tue, 15 Nov 2016 01:11:10 +0000 (01:11 +0000)
committerJiri Kosina <jkosina@suse.cz>
Wed, 23 Nov 2016 16:54:58 +0000 (17:54 +0100)
commitd443a0aa3a291e5f78072f2fa464e03bc83fafad
tree0d0f03b4fa011cb61fd89f92bdaf072a648293db
parent6dab07df555b652d8d989348b2ce04498d7f9a70
HID: hid-sensor-hub: clear memory to avoid random data

When user tried to read some fields like hysteresis from IIO sysfs on some
systems, it fails. The reason is that this field is a byte field and caller
of sensor_hub_get_feature() passes a buffer of 4 bytes. Here the function
sensor_hub_get_feature() copies the single byte from the report to the
caller buffer and returns "1" as the number of bytes copied. So caller
can use the return value.

But this is done by multiple callers, so if we just change the
sensor_hub_get_feature so that caller buffer is initialized with 0s
then we don't to change all functions.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sensor-hub.c