Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1314057ybp; Fri, 4 Oct 2019 12:45:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxl90KFyw8H0f/VFiju6jlvGkwLPsahWNMuuZ6EKG/2cKSdpRhn+dYTWI3YwYvra2qWCMrf X-Received: by 2002:a50:aa96:: with SMTP id q22mr17041519edc.179.1570218329049; Fri, 04 Oct 2019 12:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570218329; cv=none; d=google.com; s=arc-20160816; b=E1G1ELJ+QNvMyq157HtbLXGq3ltZ3pjD6yZZjHQzr4TZJ0ZyRVmj5qgVAFo/Ch1SY7 QSFtex/TW+gDkMwgt544sdKvSkcHr7HZk444tMf+xpQhTJwrFYXt10lHwfSP61sdsAp8 UKgSYPo5Gf35ZyOrAGtHi/TK8o/VDm7JvEcpTCWKd5YZetfUQ8rk20UAblqYGYk+q9Gk YGHcrU6cNDQ4ydWoDpp6ROvrgUXIRwTx13gGLl+uTjHOj6eYHgJjs8ikhkbEcubeC4Hc yFlMcLohKybp+HLJPt2GhD/xVOalfuMFSAx1gm8p4OWxEq0EEtK38AK+fm+xBqn6HcSj /sPg== 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=Fr5y/RvlB6x0gWwbCBYcM9hwB+ke8YDXuG6rntGxLCM=; b=iTSwH2qveXJ+igLGQvZxEeCAnFtArjlRuUNk10bZBAsdgB+X5wFlWm2+6JBcrQtzQt 2x9s975qu40roangWPVwNKOAZUDMOl0f4Qp2DAYpr4TQ/fcnD1efHpLnpaB92PmLe7r+ svsy6w5wPXhdxONx9sOxomK3BR9OAO1ShGxDFBA/1CYWUouDgEaeRye5fgJr3/MHGPEv L7Z3nkzVqXsXIM1760+Ur7Q/U8Ze47It7fdKySSEEyAP1+1wXA703py/DmAO9x8hn6Fn 46im7m3cSP4Qaa2XTSLePdkbMA67dq0sGd6Pn+iuzJlT9B3nY6JCX5qty2OttmyTMC6w mcuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ndMx+gJg; 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 g19si3379557ejw.373.2019.10.04.12.45.04; Fri, 04 Oct 2019 12:45:29 -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=ndMx+gJg; 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 S1730889AbfJDTng (ORCPT + 99 others); Fri, 4 Oct 2019 15:43:36 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42758 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbfJDTnf (ORCPT ); Fri, 4 Oct 2019 15:43:35 -0400 Received: by mail-wr1-f68.google.com with SMTP id n14so8487766wrw.9 for ; Fri, 04 Oct 2019 12:43:34 -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=Fr5y/RvlB6x0gWwbCBYcM9hwB+ke8YDXuG6rntGxLCM=; b=ndMx+gJgLIhohBHTBHDLgHFxGPC/IMObaTRm7UIziVbnvT2+nzCGHUbWvkLJaHL5w5 bnv6PF2vWG/05jWnf0S/GGapG6dIJfxzX4DrFUdM6HThT3OZUbNn2nG1mM9uTEN35wSx Fv7GBHmkKda60q0rQyRcViOKp7ls7vJl5R3swI/5pH5brlj6emslmsCN3sHfCp++T97s 4aBnCM/zQaetMcxBIjFROotY54DiReGqyJV1jrZHx+DKJ7fClKg2/3SNwTiVF6u2wPB2 CtKM60aFMbanXHZ3Fo8NZNM8d2gDkqvREs6S0QU2QRk93hG8ohB3uAjBfO8vXO3m3cIO 7A3w== 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=Fr5y/RvlB6x0gWwbCBYcM9hwB+ke8YDXuG6rntGxLCM=; b=gVuOdLtJUNRJXpPhqQEBr9NTtSW6ZqCROyZWWudlXnypGw3qg/JFtLpDGwH9GGVq61 Uedffvs+qxrbW0judJNeVvCZH9PHbdipqwK8X4mfH3h821jSzaLEE+No+RfVc+lRL9RV qHsskiBBCKvwtB8tBhjUIQB6axWIlk6bnFLcuXJoSYpTaQysIBqycm/DtWRr/h7e5p8g vlxvp1AsMB3uzVSEEQY9uadIjyIF+fKdXYeh7b/gVAKjzrLcDgskKzEyXlBn8FJV+waL Y+SqxX5TqKqRzqN5F6ga3uO2Ik/zznhYD1xYEX2BeIVoU6WND72Cy1LOW9Bly8FlTgZx 2fjQ== X-Gm-Message-State: APjAAAUdLylQHUgeWASThS1nHre0Do2JxyunYYO5PGhsiDHyVsluqmH8 bgSS7HzmU9Apm41cnsFiChPI2Qwe X-Received: by 2002:a5d:670f:: with SMTP id o15mr12473614wru.242.1570218213334; Fri, 04 Oct 2019 12:43:33 -0700 (PDT) Received: from archlinux-threadripper ([2a01:4f8:222:2f1b::2]) by smtp.gmail.com with ESMTPSA id f143sm11289741wme.40.2019.10.04.12.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2019 12:43:32 -0700 (PDT) Date: Fri, 4 Oct 2019 12:43:30 -0700 From: Nathan Chancellor To: Linus Torvalds Cc: Christian Brauner , Linux Kernel Mailing List Subject: Re: [GIT PULL] usercopy structs for v5.4-rc2 Message-ID: <20191004194330.GA1478788@archlinux-threadripper> References: <20191004104116.20418-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Fri, Oct 04, 2019 at 10:53:41AM -0700, Linus Torvalds wrote: > On Fri, Oct 4, 2019 at 3:42 AM Christian Brauner > 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. > > So > > if ((x = y)) > > is *wrong*. I know the compiler suggests that, but the compiler is > just being stupid, and the suggestion comes from people who don't have > any taste. > > If you want to test an assignment, you should just use > > if ((x = y) != 0) > > instead, at which point it's not syntactic noise mind-games any more, > but the parenthesis actually make sense. > > However, you had no reason to use an assignment in the conditional in > the first place. > > IOW, the code should have just been > > ret = test(umem_src == NULL, "kmalloc failed"); > if (ret) ... Yes, I had this as the original fix but I tried to keep the same intention as the original author. I should have gone with my gut. Sorry for the ugliness, I'll try to be better in the future. Cheers, Nathan