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: <87jzs1qko5.fsf@nvidia.com>
Date: Thu, 5 Oct 2023 12:16:22 +0200
From: Petr Machata <petrm@...dia.com>
To: Stephen Hemminger <stephen@...workplumber.org>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2] ila: fix array overflow warning


Stephen Hemminger <stephen@...workplumber.org> writes:

> Aliasing a 64 bit value seems to confuse Gcc 12.2.
> ipila.c:57:32: warning: ‘addr’ may be used uninitialized [-Wmaybe-uninitialized]
>
> Use a union instead.
>
> Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>

Reviewed-by: Petr Machata <petrm@...dia.com>

> ---
>  ip/ipila.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/ip/ipila.c b/ip/ipila.c
> index 23b19a108862..f4387e039f97 100644
> --- a/ip/ipila.c
> +++ b/ip/ipila.c
> @@ -47,14 +47,17 @@ static int genl_family = -1;
>  
>  static void print_addr64(__u64 addr, char *buff, size_t len)
>  {
> -	__u16 *words = (__u16 *)&addr;
> +	union {
> +		__u64 id64;
> +		__u16 words[4];
> +	} id = { .id64 = addr };
>  	__u16 v;
>  	int i, ret;
>  	size_t written = 0;
>  	char *sep = ":";
>  
>  	for (i = 0; i < 4; i++) {
> -		v = ntohs(words[i]);
> +		v = ntohs(id.words[i]);
>  
>  		if (i == 3)
>  			sep = "";


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ