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: <48034eb1-3f37-f4fd-24b3-0eb7e517b35e@infradead.org>
Date:   Sat, 18 Jun 2022 22:42:59 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Souptick Joarder <jrdr.linux@...il.com>, mpe@...erman.id.au,
        benh@...nel.crashing.org, paulus@...ba.org, npiggin@...il.com,
        christophe.leroy@...roup.eu, tglx@...utronix.de,
        mark.rutland@....com
Cc:     linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
        Kernel test robot <lkp@...el.com>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH] powerpc/interrupt: Put braces around empty body in an
 'if' statement



On 6/18/22 20:11, Souptick Joarder wrote:
> From: "Souptick Joarder (HPE)" <jrdr.linux@...il.com>
> 
> Kernel test robot throws warning ->
> 
> arch/powerpc/kernel/interrupt.c:
> In function 'interrupt_exit_kernel_prepare':
> 
>>> arch/powerpc/kernel/interrupt.c:542:55: warning: suggest
> braces around empty body in an 'if' statement [-Wempty-body]
>      542 |                 CT_WARN_ON(ct_state() == CONTEXT_USER);

That must be when CONFIG_CONTEXT_TRACKING_USER is not set/enabled.
Can you confirm that?

Then the preferable fix would be in <linux/context_tracking.h>:

change
#define CT_WARN_ON(cond)

to either an empty do-while loop or a static inline function.

(adding Frederic to Cc:)

> 
> Fix it by adding braces.
> 
> Reported-by: Kernel test robot <lkp@...el.com>
> Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@...il.com>
> ---
>  arch/powerpc/kernel/interrupt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 784ea3289c84..b8a918bab48f 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -538,8 +538,9 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
>  	 * CT_WARN_ON comes here via program_check_exception,
>  	 * so avoid recursion.
>  	 */
> -	if (TRAP(regs) != INTERRUPT_PROGRAM)
> +	if (TRAP(regs) != INTERRUPT_PROGRAM) {
>  		CT_WARN_ON(ct_state() == CONTEXT_USER);
> +	}
>  
>  	kuap = kuap_get_and_assert_locked();
>  

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ