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:   Tue, 29 May 2018 09:15:21 -0700
From:   Joe Perches <joe@...ches.com>
To:     Christophe Leroy <christophe.leroy@....fr>,
        Michal Suchánek <msuchanek@...e.de>
Cc:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Mauricio Faria de Oliveira <mauricfo@...ux.vnet.ibm.com>,
        Nicholas Piggin <npiggin@...il.com>,
        Michael Neuling <mikey@...ling.org>,
        linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powerpc/64s: Enhance the information in
 cpu_show_spectre_v1()

On Tue, 2018-05-29 at 15:24 +0000, Christophe Leroy wrote:
> On 05/29/2018 02:46 PM, Michal Suchánek wrote:
> > On Tue, 29 May 2018 16:13:49 +0200 Christophe LEROY <christophe.leroy@....fr> wrote:
[]
> > diff --git a/arch/powerpc/kernel/security.c
> > > > b/arch/powerpc/kernel/security.c index 0239383c7e4d..a0c32d53980b
> > > > 100644 --- a/arch/powerpc/kernel/security.c
> > > > +++ b/arch/powerpc/kernel/security.c
> > > > @@ -120,7 +120,10 @@ ssize_t cpu_show_spectre_v1(struct device
> > > > *dev, struct device_attribute *attr, c if
> > > > (!security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR)) return
> > > > sprintf(buf, "Not affected\n");
> > > > -	return sprintf(buf, "Vulnerable\n");
> > > > +	if (barrier_nospec_enabled)
> > > > +		return sprintf(buf, "Mitigation: __user pointer
> > > > sanitization\n");
> > > > +	else
> > > > +		return sprintf(buf, "Vulnerable\n");
> > > 
> > > Checkpatch would tell you that an else is unneeded after a return. So
> > > just leave it as it was before.
> > 
> > Where did you get your copy of checkpatch? The one in Linux tree does
> > not do that.

Correct as this particular style is a maintainer preference.

> Strange, it should, as checkpatch.pl includes the following code:
> 
> # check indentation of any line with a bare else
> # (but not if it is a multiple line "if (foo) return bar; else return baz;")

Note this comment and also that this case is

	if (foo)
		return bar;
	else
		return baz;

so no warning is generated.

> # if the previous line is a break or return and is indented 1 tab more...
> 		if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
> 			my $tabs = length($1) + 1;
> 			if ($prevline =~ /^\+\t{$tabs,$tabs}break\b/ ||
> 			    ($prevline =~ /^\+\t{$tabs,$tabs}return\b/ &&
> 			     defined $lines[$linenr] &&
> 			     $lines[$linenr] !~ /^[ \+]\t{$tabs,$tabs}return/)) {
> 				WARN("UNNECESSARY_ELSE",
> 				     "else is not generally useful after a break or return\n" . 
> $hereprev);
> 			}
> 		}
> 
> 
> Anyway, you should remove that 'else' in your patch.
> And the other sprintf line is over 80 characters.
> 
> Christophe
> 
> > 
> > Thanks
> > 
> > Michal
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ