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] [day] [month] [year] [list]
Message-ID: <b1ba214d-f3e1-4f6e-5226-2ab7761c4366@gmx.de>
Date:   Mon, 9 Jan 2023 09:03:01 +0100
From:   Helge Deller <deller@....de>
To:     Kees Cook <keescook@...omium.org>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] fbdev: Replace 0-length array with flexible array

On 1/5/23 20:20, Kees Cook wrote:
> Zero-length arrays are deprecated[1]. Replace struct aperture's "ranges"
> 0-length array with a flexible array. (How is the size of this array
> verified?) Detected with GCC 13, using -fstrict-flex-arrays=3:
>
> samples/vfio-mdev/mdpy-fb.c: In function 'mdpy_fb_probe':
> samples/vfio-mdev/mdpy-fb.c:169:32: warning: array subscript 0 is outside array bounds of 'struct aperture[0]' [-Warray-bounds=]
>    169 |         info->apertures->ranges[0].base = info->fix.smem_start;
>        |         ~~~~~~~~~~~~~~~~~~~~~~~^~~
> In file included from samples/vfio-mdev/mdpy-fb.c:21:
> include/linux/fb.h:510:19: note: while referencing 'ranges'
>    510 |                 } ranges[0];
>        |                   ^~~~~~
>
> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
>
> Cc: Helge Deller <deller@....de>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: linux-fbdev@...r.kernel.org
> Cc: dri-devel@...ts.freedesktop.org
> Signed-off-by: Kees Cook <keescook@...omium.org>

applied to the fbdev git tree.

Thanks!
Helge

> ---
>   include/linux/fb.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 96b96323e9cb..bf59d6a3590f 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -507,7 +507,7 @@ struct fb_info {
>   		struct aperture {
>   			resource_size_t base;
>   			resource_size_t size;
> -		} ranges[0];
> +		} ranges[];
>   	} *apertures;
>
>   	bool skip_vt_switch; /* no VT switch on suspend/resume required */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ