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: <6e46156f-5a81-d245-63cd-8091605deee1@linux-m68k.org>
Date:   Fri, 8 Sep 2023 09:37:12 +1000 (AEST)
From:   Finn Thain <fthain@...ux-m68k.org>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
cc:     linux-m68k@...ts.linux-m68k.org, Arnd Bergmann <arnd@...db.de>,
        Michael Schmitz <schmitzmic@...il.com>,
        Philip Blundell <philb@....org>,
        Greg Ungerer <gerg@...ux-m68k.org>,
        Joshua Thompson <funaho@...ai.org>,
        Sam Creasey <sammy@...my.net>,
        Laurent Vivier <laurent@...ier.eu>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 25/52] m68k: apollo: Replace set but not used variable
 by READ_ONCE()

On Thu, 7 Sep 2023, Geert Uytterhoeven wrote:

> --- a/arch/m68k/apollo/config.c
> +++ b/arch/m68k/apollo/config.c
> @@ -146,13 +146,11 @@ void __init config_apollo(void)
>  
>  irqreturn_t dn_timer_int(int irq, void *dev_id)
>  {
> -	volatile unsigned char x;
> -
>  	legacy_timer_tick(1);
>  	timer_heartbeat();
>  
> -	x = *(volatile unsigned char *)(apollo_timer + 3);
> -	x = *(volatile unsigned char *)(apollo_timer + 5);
> +	READ_ONCE(*(volatile unsigned char *)(apollo_timer + 3));
> +	READ_ONCE(*(volatile unsigned char *)(apollo_timer + 5));
>  
>  	return IRQ_HANDLED;
>  }
> 

I believe the volatile cast is redundant here, as READ_ONCE does that.
Perhaps the remaining cast could be deduplicated like so:

-	volatile unsigned char x;
+	unsigned char *at = (unsigned char *)apollo_timer;

  	legacy_timer_tick(1);
  	timer_heartbeat();

-	x = *(volatile unsigned char *)(apollo_timer + 3);
-	x = *(volatile unsigned char *)(apollo_timer + 5);
+	READ_ONCE(*(at + 3));
+	READ_ONCE(*(at + 5));

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ