Skip to content

Commit

Permalink
iio:adc:ti-ads124s08: Fix buffer being too long.
Browse files Browse the repository at this point in the history
commit b0bd27f upstream.

The buffer is expressed as a u32 array, yet the extra space for
the s64 timestamp was expressed as sizeof(s64)/sizeof(u16).
This will result in 2 extra u32 elements.
Fix by dividing by sizeof(u32).

Fixes: e717f8c ("iio: adc: Add the TI ads124s08 ADC code")
Signed-off-by: Jonathan Cameron<Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200920112742.170751-8-jic23@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jic23 authored and gregkh committed Dec 30, 2020
1 parent d6ea1d5 commit 2d7229c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/ti-ads124s08.c
Expand Up @@ -270,7 +270,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ads124s_private *priv = iio_priv(indio_dev);
u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u16)];
u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u32)];
int scan_index, j = 0;
int ret;

Expand Down

0 comments on commit 2d7229c

Please sign in to comment.