diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-12-12 09:33:14 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-12 16:51:03 -0800 |
commit | 8fe64955e47277abf4a3ec56383ea9b9487bd029 (patch) | |
tree | e7919ac09cbdb4d27ee04ae1e16b9c4f02fb6d99 /drivers/staging/rts5139/rts51x.h | |
parent | 641b4bb5f1c51a68f5aec7d3b47c96b39820b105 (diff) |
staging:iio:kfifo_buf: Fix potential buffer overflow in iio_read_first_n_kfifo
n is the number of bytes to read, not the number of samples. So if there is
enough data available we will write to the userspace buffer beyond its bounds.
Fix this by copying n bytes maximum. Also round n down to the next multiple of
the sample size, so we will only read complete samples. If the buffer is too
small to hold at least one sample return -EINVAL.
Also update the documentation of read_first_n to reflect the fact that 'n' is
supposed to be in bytes and not in samples.
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rts5139/rts51x.h')
0 files changed, 0 insertions, 0 deletions