Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp203709ybp; Thu, 3 Oct 2019 12:16:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZrm2dMF5tNaOpaivUAVzGYEzi5uFVP4nUvw7XL+wTLjrLgc8lnvWFTA2JJv0vd00NDHlc X-Received: by 2002:a17:906:3110:: with SMTP id 16mr9025449ejx.306.1570130213270; Thu, 03 Oct 2019 12:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570130213; cv=none; d=google.com; s=arc-20160816; b=H1vxUAJzzx7kImZdFm+oO+DK5Qsk/IbCAYzcwf31/oT5ol8QBGgFMRbE7rLU7uRPx4 SEgtpVyT3dqYO7Nv7dkuF5mbxnCWY5NPGmwKc+P4QsIqgg29p2B04fuy3ddixAJXgdF7 Gj7GYuu8as7mDEUnd0dUNXw8xXoJkWB7umBdmapI7czPV9eze046dLQWb/lra1OAYdN3 bgn2P1N8z+6hWBhXYJJnpO2O1DiAlHlICMm1jkKsY4WkR1RXmOkCWvsICZeFlN9uV/mS XKYPhqwyWnKsBxl15ljbsw35/JerBGTb1xrvAYavASnmrWW35GQaFOIxFbv9WP6P2mOS rTzw== 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; bh=qf4QH5Ba9UiTyRpS9z2U6XumxHrtjnYMMsIHrVLjpao=; b=vkatuoCiylBv/PYotGeQdNMhYoFBD7nurfr6kLnK+3J9anKJmqsETRUiEymgV/yupp JltqQHHrk/4iNW56F4W5w+l9i7uAbnDOTQQ0FNI4zhjWvde5Ij/LL6CQdt51AtylikEU bxadJJpRdJoy4NWc+/ARaxHXcbyimcWQMKB3TLy66OO4NpV5xLqH3oBS17eDnbQfiAaS 0ik9mHZ5ql+WJBkKne2hduurquja/ZZvs7dHgQUtfbO3s1g9FWw+XGunFRLCXlIC39Ws xfX4q1imA3XTGwBsTGHcyv+ZyiiBvy+CeEp/ql0mveP8L3FQLDM1wRYybIdsKerfdrrA Nyqg== 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 h19si1904778edv.393.2019.10.03.12.16.29; Thu, 03 Oct 2019 12:16:53 -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 S1730102AbfJCTNW (ORCPT + 99 others); Thu, 3 Oct 2019 15:13:22 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56203 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfJCTNV (ORCPT ); Thu, 3 Oct 2019 15:13:21 -0400 Received: from [213.220.153.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iG6XP-0007ex-8g; Thu, 03 Oct 2019 19:13:19 +0000 Date: Thu, 3 Oct 2019 21:13:18 +0200 From: Christian Brauner To: Nathan Chancellor Cc: Aleksa Sarai , Kees Cook , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] usercopy: Add parentheses around assignment in test_copy_struct_from_user Message-ID: <20191003191318.q6jvzuf46gjygpux@wittgenstein> References: <20191003171121.2723619-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191003171121.2723619-1-natechancellor@gmail.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 10:11:21AM -0700, Nathan Chancellor wrote: > Clang warns: > > lib/test_user_copy.c:96:10: warning: using the result of an assignment > as a condition without parentheses [-Wparentheses] > if (ret |= test(umem_src == NULL, "kmalloc failed")) > ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/test_user_copy.c:96:10: note: place parentheses around the > assignment to silence this warning > if (ret |= test(umem_src == NULL, "kmalloc failed")) > ^ > ( ) > lib/test_user_copy.c:96:10: note: use '!=' to turn this compound > assignment into an inequality comparison > if (ret |= test(umem_src == NULL, "kmalloc failed")) > ^~ > != > > Add the parentheses as it suggests because this is intentional. > > Fixes: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper") > Link: https://github.com/ClangBuiltLinux/linux/issues/731 > Signed-off-by: Nathan Chancellor Applied to: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=copy_struct_from_user Thanks! Christian