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]
Date:	Fri, 15 Jul 2016 15:23:05 +0200
From:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	linaro-kernel@...ts.linaro.org,
	Build bot for Mark Brown <broonie@...nel.org>,
	kernel-build-reports@...ts.linaro.org,
	linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: v4.4.12-rt20 build: 0 failures 5 warnings (v4.4.12-rt20)

* Arnd Bergmann | 2016-07-15 14:29:31 [+0200]:

>Agreed, but it's hard for the compiler to figure that out. On mainline,

we have the same thing in drivers/tty/serial/8250/8250_port.c btw. Don't
see the warning there.

>we have this instead:
>
>       local_irq_save(flags);
>       if (uap->port.sysrq)
>               locked = 0;
>       else if (oops_in_progress)
>               locked = spin_trylock(&uap->port.lock);
>       else
>               spin_lock(&uap->port.lock);
>…
>       if (locked)
>               spin_unlock(&uap->port.lock);
>       local_irq_restore(flags);
>
>which looks like it's intentionally written to avoid the warning
>and was changed by Thomas in "tty/serial/pl011: Make the locking work on RT":
>
>http://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit/drivers/tty/serial/amba-pl011.c?h=v4.4-rt-rebase&id=7b537b66fcb12c40eb1b10eb352d570a9d34a657
>
>Maybe there is another way to write this upstream that avoids the
>warning.

I don't see any other way around except for initializing flags upfront:

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2161,18 +2161,17 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_amba_port *uap = amba_ports[co->index];
 	unsigned int old_cr = 0, new_cr;
-	unsigned long flags;
+	unsigned long flags = 0;
 	int locked = 1;
 
 	clk_enable(uap->clk);
 
-	local_irq_save(flags);
 	if (uap->port.sysrq)
 		locked = 0;
 	else if (oops_in_progress)
-		locked = spin_trylock(&uap->port.lock);
+		locked = spin_trylock_irqsave(&uap->port.lock, flags);
 	else
-		spin_lock(&uap->port.lock);
+		spin_lock_irqsave(&uap->port.lock, flags);
 
 	/*
 	 *	First save the CR then disable the interrupts
@@ -2196,8 +2195,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
 		pl011_write(old_cr, uap, REG_CR);
 
 	if (locked)
-		spin_unlock(&uap->port.lock);
-	local_irq_restore(flags);
+		spin_unlock_irqrestore(&uap->port.lock, flags);
 
 	clk_disable(uap->clk);
 }

>	Arnd

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ