staging: iio: adc: max1363: prevent buffer overflow
authorMichael Hennerich <michael.hennerich@analog.com>
Wed, 6 Oct 2010 14:15:37 +0000 (16:15 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Oct 2010 15:21:28 +0000 (08:21 -0700)
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>
drivers/staging/iio/adc/max1363_ring.c

index 1d6ce54e9a86967e8d37f3cfb3ff91c023dd7e7f..896a3672b3327d69831cc9e2c861651b1b4ea207 100644 (file)
@@ -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;
This page took 0.025347 seconds and 5 git commands to generate.