summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/ltr501.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-11-27 14:55:56 +0100
committerJonathan Cameron <jic23@kernel.org>2015-12-05 17:32:04 +0000
commitd590faf9e8f8509a0a0aa79c38e87fcc6b913248 (patch)
treedf934098d2d534d121b2afb1f64ec9cf994a65b2 /drivers/iio/light/ltr501.c
parent9225c0b7b976dd9ceac2b80727a60d8fcb906a62 (diff)
downloadlinux-d590faf9e8f8509a0a0aa79c38e87fcc6b913248.tar.bz2
iio: adis_buffer: Fix out-of-bounds memory access
The SPI tx and rx buffers are both supposed to be scan_bytes amount of bytes large and a common allocation is used to allocate both buffers. This puts the beginning of the tx buffer scan_bytes bytes after the rx buffer. The initialization of the tx buffer pointer is done adding scan_bytes to the beginning of the rx buffer, but since the rx buffer is of type __be16 this will actually add two times as much and the tx buffer ends up pointing after the allocated buffer. Fix this by using scan_count, which is scan_bytes / 2, instead of scan_bytes when initializing the tx buffer pointer. Fixes: aacff892cbd5 ("staging:iio:adis: Preallocate transfer message") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light/ltr501.c')
0 files changed, 0 insertions, 0 deletions