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] [day] [month] [year] [list]
Message-ID: <20191006104703.jqn7qfcjlflgx5sp@yavin.dot.cyphar.com>
Date:   Sun, 6 Oct 2019 21:47:03 +1100
From:   Aleksa Sarai <cyphar@...har.com>
To:     Christian Brauner <christian.brauner@...ntu.com>
Cc:     Kees Cook <keescook@...omium.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: test_user_copy: style cleanup

On 2019-10-06, Christian Brauner <christian.brauner@...ntu.com> wrote:
> On Sun, Oct 06, 2019 at 10:30:28AM +1100, Aleksa Sarai wrote:
> > While writing the tests for copy_struct_from_user(), I used a construct
> > that Linus doesn't appear to be too fond of:
> > 
> > On 2019-10-04, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> > > Hmm. That code is ugly, both before and after the fix.
> > >
> > > This just doesn't make sense for so many reasons:
> > >
> > >         if ((ret |= test(umem_src == NULL, "kmalloc failed")))
> > >
> > > where the insanity comes from
> > >
> > >  - why "|=" when you know that "ret" was zero before (and it had to
> > >    be, for the test to make sense)
> > >
> > >  - why do this as a single line anyway?
> > >
> > >  - don't do the stupid "double parenthesis" to hide a warning. Make it
> > >    use an actual comparison if you add a layer of parentheses.
> > 
> > So instead, use a bog-standard check that isn't nearly as ugly.
> > 
> > Fixes: 341115822f88 ("usercopy: Add parentheses around assignment in test_copy_struct_from_user")
> > Fixes: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper")
> > Signed-off-by: Aleksa Sarai <cyphar@...har.com>
> 
> Fwiw, I think the commit message doesn't necessarily need to mention
> stylistic preferences nor a specific mail. It's sufficient enough to say
> that the new way makes things way more obvious. But ok. :)
> 
> I'll pick this up now.

Thanks, and feel free to rewrite the commit message to whatever you'd
prefer.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ