Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2827734ybp; Sat, 5 Oct 2019 22:02:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyQ0Pc2uTv4amhqwblPquhpow9TW9WZwsXOEyyKSrH0lDN3doh6rSJWiisurVKsbwQ2ePg X-Received: by 2002:a17:906:b30b:: with SMTP id n11mr19009557ejz.35.1570338156801; Sat, 05 Oct 2019 22:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570338156; cv=none; d=google.com; s=arc-20160816; b=sxwOQ8j/gLn5bbLxCiFoPGQLfj4/03sl+039mUi2yXC5El02innfFBQAXst+Z74E6w 6/tA33yzE0uxMHvzCJnipuPFfmk9FGQnp/haSKLdpBFLUvce6ja5NkLXJ+Y3BBCEJiGn flBURAaw6hXJbMUqAbEoELnYa0J0pnEh+ehfLjxfJnsLwEyEa8UtiIgEhrKcNGcaWaXH CiT15iztDG5u89471FmeFQSBNPf6y8iMcAjL1zbBAoZYGMRTzVOXH9LffzftRhdvaeDC A8hai9n0qsXGYXgkbufVEtMAi35aliK3v1y9hbby5PiswENbjB1zj0adfwjILq7kQHI/ 8TQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tTvAuzGrj/MaPLYLsAwRasMomLPOQMmMC24Exul2pJo=; b=H3IJ1famqWAWKOMco8HkeLbuLmPZBv873ifxR+OzKHcDh7Vk8W0nLkOOFsA3Qv7GbO F0/SFaZaY+vMu8lstqEj3B78phEog/XtWGT6DAfNY6uHvb3aWTjDSXlGPDBAhMJmcpQy geMlwB5gvVYka71RQuqylRAbug6uoF1TOAyGtBgwTx+T4PD+xvwdOqncLNkD+GAmCGpd u3Mf2Cm4rZkEW+043NGl3nfNGVSaMJqt6VoQBjkbo0CraOdnhiFlEzkXYA4Bk1YQczvK SUezAm9nun7yoihra0Lv9yM66bxG4RctcvPl++V6g0uTn61I+EYCV/E6LhhAt9tM+M64 bI5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GuL7aQSD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si5230736ejj.119.2019.10.05.22.01.58; Sat, 05 Oct 2019 22:02:36 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GuL7aQSD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726086AbfJFFBo (ORCPT + 99 others); Sun, 6 Oct 2019 01:01:44 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37978 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfJFFBn (ORCPT ); Sun, 6 Oct 2019 01:01:43 -0400 Received: by mail-wm1-f65.google.com with SMTP id 3so9251398wmi.3 for ; Sat, 05 Oct 2019 22:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tTvAuzGrj/MaPLYLsAwRasMomLPOQMmMC24Exul2pJo=; b=GuL7aQSDIQWPIdAcQ9Nt/0D4W+tz6PgwMt55Bhf1YJo6ds/MBb/JvrI3avuLcMq+Os Mzx7Ced4FgCUuIRkGwSz8AdrSrS0fn+BAuytVpeujtg3fgw/V/KhYQNzdkAlXsFBBjHT kU+AsWK78V4XQ+hM5yhfsenI1W51D1hWTyOGhjeIkERaz0MYANAiQYXTe98NfR1ncDId roIE0kyOcOJn0uoAvq+fBq4HIH1Z802qxRBuuiKKUAgPYlqZBDZcvw2FZeuJ05m6kskL GeT06yX8zVZfEghgVSULaDGgwNSNFImn1VKljDsTlRScSHQ+iEITXnV7FnjIm3OfPkqu OnTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tTvAuzGrj/MaPLYLsAwRasMomLPOQMmMC24Exul2pJo=; b=I68eLzTAlcHAtM7xnLF1fCe8GaqH7ktLP259/IPcz26NKgdTQHDyDWeog+F+0IPcz9 Alz59YQozuWkXTEgyw84mnOyy7GEwA4FWi7rV8//bPrcwxq5AQTiw6Mf3eqrro581bhx tMUW3xtPB5TX6kAO2BzdIjD1DkCtx57ZIN0h8ysTEVgpXbEgMmHCHUT8AbfFwWqJd7OE nGxr/Hma/ZB6LvOSnrtw+RujSOARoINWcfeQ84HdH+MajSg5yABiPfnAvwJn4KamMob1 /lu+sNvGnrSp4M9AtlttPvmzpOhCgolk7UGv4o+7ILZ7F0GNPREaXrLgpOlZKhWCLiej nglw== X-Gm-Message-State: APjAAAWhkIGQxJjDenlxEnVsr+VJGN8yQdKPW840C3LkK+NeHurDHb+D dcGbAAHDXMgvdSa67Nv7vU8= X-Received: by 2002:a1c:968b:: with SMTP id y133mr15582411wmd.56.1570338099787; Sat, 05 Oct 2019 22:01:39 -0700 (PDT) Received: from archlinux-threadripper ([2a01:4f8:222:2f1b::2]) by smtp.gmail.com with ESMTPSA id r27sm32339652wrc.55.2019.10.05.22.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2019 22:01:39 -0700 (PDT) Date: Sat, 5 Oct 2019 22:01:37 -0700 From: Nathan Chancellor To: Aleksa Sarai Cc: Christian Brauner , Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib: test_user_copy: style cleanup Message-ID: <20191006050137.GA1789703@archlinux-threadripper> References: <20191005233028.18566-1-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191005233028.18566-1-cyphar@cyphar.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 I assume the comment diff is a line length/alignment thing? The commit message does not mention it. Regardless, thank you for providing the fix that I should have. Reviewed-by: Nathan Chancellor