summaryrefslogtreecommitdiffstats
path: root/drivers/iio/potentiometer
diff options
context:
space:
mode:
authorHimanshu Jha <himanshujha199640@gmail.com>2018-03-09 00:15:33 +0530
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-03-10 15:02:41 +0000
commita937729c9358f1c66a444af1f4f64ececc9a2f68 (patch)
tree296fdadbf0adf929396e3ed5c7545b23eca458fe /drivers/iio/potentiometer
parent2ab5b72453672ea18a176925becc40888df435ce (diff)
downloadop-kernel-dev-a937729c9358f1c66a444af1f4f64ececc9a2f68.zip
op-kernel-dev-a937729c9358f1c66a444af1f4f64ececc9a2f68.tar.gz
iio: potentiometer: ds1803: Remove VLA usage
In preparation to enabling -Wvla, remove VLA usage and replace it with fixed a fixed length array and therefore, prevent potential stack overflow attacks. Fixed as a part of the discussion to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Cc: keescook@chromium.org Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/potentiometer')
-rw-r--r--drivers/iio/potentiometer/ds1803.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/potentiometer/ds1803.c b/drivers/iio/potentiometer/ds1803.c
index 9b0ff4a..6bf12c9 100644
--- a/drivers/iio/potentiometer/ds1803.c
+++ b/drivers/iio/potentiometer/ds1803.c
@@ -64,7 +64,7 @@ static int ds1803_read_raw(struct iio_dev *indio_dev,
struct ds1803_data *data = iio_priv(indio_dev);
int pot = chan->channel;
int ret;
- u8 result[indio_dev->num_channels];
+ u8 result[ARRAY_SIZE(ds1803_channels)];
switch (mask) {
case IIO_CHAN_INFO_RAW:
OpenPOWER on IntegriCloud