Messages in this thread | | | Date | Sat, 5 Oct 2019 05:07:13 +1000 | From | Aleksa Sarai <> | Subject | Re: [GIT PULL] usercopy structs for v5.4-rc2 |
| |
On 2019-10-04, Linus Torvalds <torvalds@linux-foundation.org> wrote: > On Fri, Oct 4, 2019 at 3:42 AM Christian Brauner > <christian.brauner@ubuntu.com> wrote: > > > > The only separate fix we we had to apply > > was for a warning by clang when building the tests for using the result of > > an assignment as a condition without parantheses. > > 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.
You're quite right -- I was mindlessly copying the "ret |=" logic the rest of test_user_copy.c does without thinking about it. I'll include a cleanup for it in the openat2(2) series.
-- Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH <https://www.cyphar.com/> [unhandled content-type:application/pgp-signature] | |