Commit e1517c00 authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

staging: iio: adc: max1363: prevent buffer overflow

ring->access.read_last() reads the entire datum from
the ring including padding and time stamp.
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 858f1ccf
...@@ -38,9 +38,8 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st) ...@@ -38,9 +38,8 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
ret = -EBUSY; ret = -EBUSY;
goto error_ret; goto error_ret;
} }
numvals = hweight_long(st->current_mode->modemask);
ring_data = kmalloc(numvals*2, GFP_KERNEL); ring_data = kmalloc(ring->access.get_bytes_per_datum(ring), GFP_KERNEL);
if (ring_data == NULL) { if (ring_data == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto error_ret; goto error_ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment