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]
Message-ID: <9ff27422-911a-c285-108c-f29908b68d19@embeddedor.com>
Date:   Thu, 30 Apr 2020 16:46:37 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Andrzej Hajda <a.hajda@...sung.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sylwester Nawrocki <s.nawrocki@...sung.com>
Cc:     Mauro Carvalho Chehab <m.chehab@...sung.com>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
        linux-media@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH 12/15] media: s5k5baf: avoid gcc-10 zero-length-bounds
 warning

Hi Arnd,

On 4/30/20 16:30, Arnd Bergmann wrote:
> gcc-10 warns about accessing a zero-length struct member:
> 
> drivers/media/i2c/s5k5baf.c: In function 's5k5baf_load_setfile':
> drivers/media/i2c/s5k5baf.c:390:13: warning: array subscript 65535 is outside the bounds of an interior zero-length array 'struct <anonymous>[0]' [-Wzero-length-bounds]
>   390 |   if (f->seq[i].offset + d <= end)
>       |       ~~~~~~^~~
> 
> This should really be a flexible-array member, but the structure
> already has one. I experimentally confirmed that swapping the two
> avoids the warning, as the 'data[]' array is not accessed like this.
> 
> Fixes: 3ba225b506a2 ("treewide: Replace zero-length array with flexible-array member")
> Fixes: 7d459937dc09 ("[media] Add driver for Samsung S5K5BAF camera sensor")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/media/i2c/s5k5baf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
> index 42584a088273..0b1ddedcf7dc 100644
> --- a/drivers/media/i2c/s5k5baf.c
> +++ b/drivers/media/i2c/s5k5baf.c
> @@ -277,11 +277,11 @@ enum {
>  
>  struct s5k5baf_fw {
>  	u16 count;
> +	u16 data[0];
>  	struct {
>  		u16 id;
>  		u16 offset;
> -	} seq[0];
> -	u16 data[];
> +	} seq[];
>  };
>  
>  struct s5k5baf {
> 

The treewide patch is an experimental change and, as this change only applies
to my -next tree, I will carry this patch in it, so other people don't have
to worry about this at all.

Thank you
--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ