diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2014-01-13 11:02:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2014-02-08 05:06:30 -0500 |
commit | d4bf105bb65b61fd9036031a1854383381ef638f (patch) | |
tree | 96384feff84219f9b1228b8eefeb662726c69cc8 | |
parent | 71bd89454d4cd6a4d0304aa8c3304ed8b0a294dc (diff) |
iio: mxs-lradc: fix buffer overflow
Fixes:
drivers/staging/iio/adc/mxs-lradc.c:1556 mxs_lradc_probe() error: buffer
overflow 'iio->channels' 15 <= 15
The reported available scales for in_voltage15 were also wrong.
The realbits lookup is not necessary as all the channels of the LRADC have the
same resolution, use LRADC_RESOLUTION instead.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/staging/iio/adc/mxs-lradc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index df71669bb60e..aa86849daeba 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -1613,7 +1613,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
1613 | * of the array. | 1613 | * of the array. |
1614 | */ | 1614 | */ |
1615 | scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >> | 1615 | scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >> |
1616 | (iio->channels[i].scan_type.realbits - s); | 1616 | (LRADC_RESOLUTION - s); |
1617 | lradc->scale_avail[i][s].nano = | 1617 | lradc->scale_avail[i][s].nano = |
1618 | do_div(scale_uv, 100000000) * 10; | 1618 | do_div(scale_uv, 100000000) * 10; |
1619 | lradc->scale_avail[i][s].integer = scale_uv; | 1619 | lradc->scale_avail[i][s].integer = scale_uv; |