Skip to content

Commit 5b69c23

Browse files
Dan CarpenterEnric Balletbo i Serra
authored andcommitted
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: 145d59b ("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]>
1 parent a463877 commit 5b69c23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/chrome/cros_ec_sensorhub_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cros_sensorhub_send_sample(struct cros_ec_sensorhub *sensorhub,
4040
int id = sample->sensor_id;
4141
struct iio_dev *indio_dev;
4242

43-
if (id > sensorhub->sensor_num)
43+
if (id >= sensorhub->sensor_num)
4444
return -EINVAL;
4545

4646
cb = sensorhub->push_data[id].push_data_cb;

0 commit comments

Comments
 (0)