aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/adc/max1363_ring.c
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2010-10-06 16:15:37 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-06 08:21:28 -0700
commite1517c00da6d35911b6451f886d55e22d56393ad (patch)
treee6f3685efd736167ee0137aa305e102a39600c11 /drivers/staging/iio/adc/max1363_ring.c
parent858f1ccff123469fb4257e2529ef8783aabf3b62 (diff)
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: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/adc/max1363_ring.c')
-rw-r--r--drivers/staging/iio/adc/max1363_ring.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c
index 1d6ce54e9a8..896a3672b33 100644
--- a/drivers/staging/iio/adc/max1363_ring.c
+++ b/drivers/staging/iio/adc/max1363_ring.c
@@ -38,9 +38,8 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
ret = -EBUSY;
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) {
ret = -ENOMEM;
goto error_ret;