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: <f321ef65-fbbc-4bad-ad95-f2287bd82a32@gaisler.com>
Date: Fri, 17 Jan 2025 15:43:23 +0100
From: Andreas Larsson <andreas@...sler.com>
To: Zhang Kunbo <zhangkunbo@...wei.com>, davem@...emloft.net,
 rdunlap@...radead.org, bhelgaas@...gle.com
Cc: sparclinux@...r.kernel.org, linux-kernel@...r.kernel.org,
 chris.zjh@...wei.com, liaochang1@...wei.com
Subject: Re: [PATCH -next] sparc: replace zero-length array with
 flexible-array member

On 2024-12-18 08:44, Zhang Kunbo wrote:
> The current codebase makes use of the zero-length array language
> extension to the C90 standard, but the preferred mechanism to declare
> variable-length types such as these ones is a flexible array member[1],
> introduced in C99:
> 
> struct foo {
> 	int stuff;
> 	struct boo array[];
> };
> 
> By making use of the mechanism above, we will get a compiler warning
> in case the flexible array does not occur last, which is beneficial
> to cultivate a high-quality code.[2]
> 
> This issue was found with the help of Coccinelle.
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> [2] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
> 
> Signed-off-by: Zhang Kunbo <zhangkunbo@...wei.com>
> ---
>  arch/sparc/kernel/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> index 50a0927a84a6..ddac216a2aff 100644
> --- a/arch/sparc/kernel/pci.c
> +++ b/arch/sparc/kernel/pci.c
> @@ -932,7 +932,7 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
>  {
>  	const struct pci_slot_names {
>  		u32	slot_mask;
> -		char	names[0];
> +		char	names[];
>  	} *prop;
>  	const char *sp;
>  	int len, i;

Reviewed-by: Andreas Larsson <andreas@...sler.com>

Picking this up to my for-next.

Thanks,
Andreas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ