lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 8 Mar 2018 11:39:15 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Himanshu Jha <himanshujha199640@...il.com>
Cc:     jic23@...nel.org, Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Subject: Re: [PATCH] iio: potentiometer: ds1803: Remove VLA usage

On Thu, Mar 8, 2018 at 10:45 AM, Himanshu Jha
<himanshujha199640@...il.com> wrote:
> 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@...omium.org
> Signed-off-by: Himanshu Jha <himanshujha199640@...il.com>
> ---
>  drivers/iio/potentiometer/ds1803.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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)];

It seems like num_channels is always ARRAY_SIZE(ds1803_channels).
Could the entire field be dropped?

-Kees

>
>         switch (mask) {
>         case IIO_CHAN_INFO_RAW:
> --
> 2.7.4
>



-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ