mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
iio: chemical: Use iio_push_to_buffers_with_ts() to provide length for runtime checks.
This new function allows us to perform debug checks in the helper to ensure that the overrun does not occur. Use it in all the simple cases where either a static buffer or a structure is used in the drivers. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250413103443.2420727-13-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
838a65c1d6
commit
cb4691913d
|
|
@ -458,8 +458,9 @@ static irqreturn_t atlas_trigger_handler(int irq, void *private)
|
|||
&data->buffer, sizeof(__be32) * channels);
|
||||
|
||||
if (!ret)
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
|
||||
iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, data->buffer,
|
||||
sizeof(data->buffer),
|
||||
iio_get_time_ns(indio_dev));
|
||||
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
|
|
|
|||
|
|
@ -1120,8 +1120,8 @@ static irqreturn_t bme680_trigger_handler(int irq, void *p)
|
|||
gas_range = FIELD_GET(BME680_GAS_RANGE_MASK, gas_regs_val);
|
||||
data->scan.chan[3] = bme680_compensate_gas(data, adc_gas_res, gas_range);
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
|
||||
iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &data->scan, sizeof(data->scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
out:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
return IRQ_HANDLED;
|
||||
|
|
|
|||
|
|
@ -343,8 +343,8 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p)
|
|||
goto err;
|
||||
}
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
|
||||
iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &data->scan, sizeof(data->scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
|
||||
err:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
|
|
|||
|
|
@ -267,8 +267,8 @@ static irqreturn_t ens160_trigger_handler(int irq, void *p)
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
|
||||
pf->timestamp);
|
||||
iio_push_to_buffers_with_ts(indio_dev, &data->scan, sizeof(data->scan),
|
||||
pf->timestamp);
|
||||
err:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ static irqreturn_t pms7003_trigger_handler(int irq, void *p)
|
|||
pms7003_get_pm(frame->data + PMS7003_PM10_OFFSET);
|
||||
mutex_unlock(&state->lock);
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &state->scan,
|
||||
iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &state->scan, sizeof(state->scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
err:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
|
|
|
|||
|
|
@ -601,7 +601,8 @@ static irqreturn_t scd30_trigger_handler(int irq, void *p)
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
out:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
return IRQ_HANDLED;
|
||||
|
|
|
|||
|
|
@ -675,7 +675,8 @@ static irqreturn_t scd4x_trigger_handler(int irq, void *p)
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
out:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
return IRQ_HANDLED;
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &scan,
|
||||
iio_get_time_ns(indio_dev));
|
||||
iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
|
||||
iio_get_time_ns(indio_dev));
|
||||
err:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user