mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-08 18:43:21 +01:00
platform/chrome: cros_ec_sensorhub: Off by one in cros_sensorhub_send_sample()
The sensorhub->push_data[] array has sensorhub->sensor_num elements.
It's allocated in cros_ec_sensorhub_ring_add(). So the > should be >=
to prevent a read one element beyond the end of the array.
Fixes: 145d59baff ("platform/chrome: cros_ec_sensorhub: Add FIFO support")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Enric Balletbo i Serra <[email protected]>
This commit is contained in:
1 parent
a46387712d
commit
5b69c23799
1 file changed
+1
-1
@@ -40,7 +40,7 @@ cros_sensorhub_send_sample(struct cros_ec_sensorhub *sensorhub,
|
||||
int id = sample->sensor_id;
|
||||
struct iio_dev *indio_dev;
|
||||
|
||||
if (id > sensorhub->sensor_num)
|
||||
if (id >= sensorhub->sensor_num)
|
||||
return -EINVAL;
|
||||
|
||||
cb = sensorhub->push_data[id].push_data_cb;
|
||||
|
||||
Reference in new issue
Block a user