Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3053355ybp; Sun, 6 Oct 2019 03:49:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzeLy+fcz9HG3WufsClks65CHIUTL5fUYuW6RUU1G4iE+B7GJ/FldBoNonIIPI/5P7ULLM X-Received: by 2002:a50:f19c:: with SMTP id x28mr23556389edl.42.1570358979018; Sun, 06 Oct 2019 03:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570358979; cv=none; d=google.com; s=arc-20160816; b=VjWHE/Fp1ajxPG1vdiyjl5BGqZIckdoNTwxQ9B/LLmiLTfhKR8nQRUVpu78fn5O9D7 ZYABDOw7oJXSQ0XwkyQIS3KPgvdsL5W6O3o53f+DVHj9FBFWZbIpaurjRP0EAHMJz5uI GUPSIPwkbRJeKj8rzuSpedbY9HQxDlXQ4l1DW5Ug71AxA0X5CiTBH2dzXpbl6Dq2foa4 x3Lx+col61F2J5MTp7jCP4PW7JvNiDge7UENsX7xerR+CxI5kHsT8kYILrYIFesGO+5p J1k7m41ygPvUIIvuCXpS1zZHpEiAo8ca1AOoyrdn40NIu419aLf31PLFrBuwyeqVAVtj gSsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZO4x2dO+r+Dz4S6VEEjOHpK/FlT4kBGOisglDOTldog=; b=Eq2Nvv0RWtahFFXdyB3lnI1Kml43EsqzApvPoRgB6DmDNeivb8wrRUwF3/M+LTHO91 0sPSr+nUZ9vGsJtAAfikVs4tBEXVZYZ5Dn+9P1rafq5lf6Igj0mI7C1RB+Smh/pXSCPT IqQ/Ayfu7fZyWrtJstVPEnHcxniRlBt8ksjYZFz3aW+qy2hAKhHLKo0/N2QDHPKf/oRK VBgdRVL+vGbPJhFGs/loVjO7xyHLedNVtNMC21B3tW4vxNoAnpjMCGEQ7hNvy2j4oBKa nPE+Fx5sQvCriirUssdiAjJWslDSTRcGVKNPRqKw8c60FnoAbRBc0FMgqH4pHtz1tWXk +uHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by16si6196771edb.30.2019.10.06.03.49.15; Sun, 06 Oct 2019 03:49:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbfJFKre (ORCPT + 99 others); Sun, 6 Oct 2019 06:47:34 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:13308 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbfJFKrd (ORCPT ); Sun, 6 Oct 2019 06:47:33 -0400 Received: from smtp2.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id E9698A37CC; Sun, 6 Oct 2019 12:47:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 0ELAmdKFdD_J; Sun, 6 Oct 2019 12:47:14 +0200 (CEST) Date: Sun, 6 Oct 2019 21:47:03 +1100 From: Aleksa Sarai To: Christian Brauner Cc: Kees Cook , Nathan Chancellor , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib: test_user_copy: style cleanup Message-ID: <20191006104703.jqn7qfcjlflgx5sp@yavin.dot.cyphar.com> References: <20191005233028.18566-1-cyphar@cyphar.com> <20191006084102.mhqrsyg5slbfwejd@wittgenstein> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jyhn67am2k4t4wxp" Content-Disposition: inline In-Reply-To: <20191006084102.mhqrsyg5slbfwejd@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jyhn67am2k4t4wxp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-10-06, Christian Brauner 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: > >=20 > > On 2019-10-04, Linus Torvalds wrote: > > > Hmm. That code is ugly, both before and after the fix. > > > > > > This just doesn't make sense for so many reasons: > > > > > > if ((ret |=3D test(umem_src =3D=3D NULL, "kmalloc failed"))) > > > > > > where the insanity comes from > > > > > > - why "|=3D" 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. > >=20 > > So instead, use a bog-standard check that isn't nearly as ugly. > >=20 > > Fixes: 341115822f88 ("usercopy: Add parentheses around assignment in te= st_copy_struct_from_user") > > Fixes: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper") > > Signed-off-by: Aleksa Sarai >=20 > 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. :) >=20 > I'll pick this up now. Thanks, and feel free to rewrite the commit message to whatever you'd prefer. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --jyhn67am2k4t4wxp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXZnGJAAKCRCdlLljIbnQ Eij3AP9AppWhz2UrNZFZwahOKB6K15CtcIrsH4fmtSSnntOPjQD9HKUd7PTtbkg+ t5Le+eFWp4nsyHectmZKqsivds2iLgU= =cwwz -----END PGP SIGNATURE----- --jyhn67am2k4t4wxp--