Skip to content
Commit d443a0aa authored by Song Hongyan's avatar Song Hongyan Committed by Jiri Kosina
Browse files

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: default avatarSong Hongyan <hongyan.song@intel.com>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 6dab07df
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment