Skip to content

Commit

Permalink
staging: iio: adc: max1363: prevent buffer overflow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Oct 6, 2010
1 parent 858f1cc commit e1517c0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/iio/adc/max1363_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e1517c0

Please sign in to comment.