From patchwork Fri Jul 14 09:25:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107749 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp650549qge; Fri, 14 Jul 2017 02:29:16 -0700 (PDT) X-Received: by 10.98.222.3 with SMTP id h3mr4118548pfg.93.1500024556629; Fri, 14 Jul 2017 02:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500024556; cv=none; d=google.com; s=arc-20160816; b=tBy0XVRIgrIvIgGTrMzlSO3m1QSC1aWu521A8voforcH8F/nFEsWqdSLu4o0AH772L KtqJat+6TwrDyhWPFo55b+8iuwvERn82cujV8O+ez6IB/ORERZXG9ok56f7HCPGIxGkd dJPtdvgh6u2kZ9o+wSX0JVotyEt8uH/ow9JepGtjjogRrWeY2L2gmZEYOzSbYmFUTmGD /g1jmd0wg+Y63CQ/bmAiulvmu0f+aTgdhwGk+e+Etj3NwODFaqMtfvmhODUdYy4Wfyr9 42h3uynOFadnK2E7JRaTkt2eYOxjlDWV1IZCR5Q9NetrVgkAFo5MbKD3sWgRCKYM766E ARtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:cc :mime-version:references:in-reply-to:message-id:date:subject:to:from :delivered-to:arc-authentication-results; bh=jJWiDUbERNSNi8DC0Rilsop5tLTyvJJwrsBVPTB0iEI=; b=v2mYCgfGbLo1RTgoTbon3Mpzt7vOjzDGLwFkjZrywYxEJ+LXp2+Rpd/3NuBw9LJ/1Y 6LW30a5bkPVncD7zQQ5XH6XjlJUjHm3GEwsLN0ffh6x2SdWoJJo29hb6bxeXAgg3tkA8 XDYePOSXWw71j0wE+jUJR8xMMQbxquq4r5uEXaZG/f+gikrWNUxftxwNJm4vn89p7Rgv xLr5AqDIKHF2n4OwUC2NvWAWdMf4N4rqlRFxIRnCK+kM5Q2wCAEEUJ60jHC4X7F63l3L 6r/xT/zci2n4oC2WCmjEoDR/NrPjZchkVPnjy9z2A2kDMFjjEryAiXgIxi2xm4hq9r32 2ZUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id l11si6269116plk.441.2017.07.14.02.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 02:29:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AC746E7B5; Fri, 14 Jul 2017 09:29:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id D01066E7B5 for ; Fri, 14 Jul 2017 09:29:13 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MJEQE-1dUHwD2R2o-002qFi; Fri, 14 Jul 2017 11:28:23 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Jiri Olsa Subject: [PATCH 07/14] proc/kcore: hide a harmless warning Date: Fri, 14 Jul 2017 11:25:19 +0200 Message-Id: <20170714092540.1217397-8-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:ghCtubTquugxYj8GXBf21w0WF6x6A7m1oGb4vIk2ntS06+UzIB7 6rSzAPq4SiIApfV4cpU6NyXP3Lms3VmwqLd02hu5oG8f9aBijH3E7GPqdnd0D/tRxFZ1B7O mufbTLejE0GUH25bXTY4+iJRQq9yyK+RLzpSTzIMRUSoG7Awnhh1Ki4r6cvqJhnWQCj5jK6 OG1uvXkfoIQensG4aEkNg== X-UI-Out-Filterresults: notjunk:1; V01:K0:REZFiXnP75U=:QZwO4+FWBmB5fJGgVtJAmK QMxqjeknBVgUZ4ccWWGvHi3vgPcQrS7LICvNYSdg/1GSkAZ/51b2BVWaM0Bv2XWbggrITk4jL toVt7XqPzBvQRJEWK8cJeeAwAeWpboQ4Us4Pt16cL8jfDHOarruueiTt2lV8fiVFlib67u8SP wXeva3XyP7IzKno9Qtxu0yBOhsgGaqA55gFBiBko9WGgeMqSlYfG8IrWW2alUJ1ZR2KnvP0aC KMp1t6m76DYRqbebZx22VTmn+vYa88lcsGipB3YMBnliZiQZswz8lelgyq0D1jTGiKGKCL4ic Rtlayygx1DV2cdny4TY6aWbOb49OsQj117vox635BsTNtWFklepnAbgIImRKN9x1tyjyoWGHh 8j0qIho8amkwuBLMc4HCG5PxdqPn+A7r4rg3ro46pTnwBG4jLtwkRc5FkmFTnHOuaWvdjVXVY t7cn+qqwzQcISu2a6JVmIfuknRW7i65Tq4gDxv28mq3t1vaSZ9IBZLRV1nLytX3aNb5K8JTpS FmeXhDhxaIUdNwwyXnjid32kQ/kf6/X1v/dCWEuc2AhIZ9rylZj6wz6Y84XcpwLz8Nh44AU+R bz7W6r0adv6voPGOYlOJ4N93V7yrrkXZx39uQk0HE0/wuWVf/5JWs4XzV6cOvBHk7GWLVIZlU fR6V/MUzAUYAnYdKP0wutv0ayO2AOUlF5MYXxH9H07JhwDW4Cts+rpJg3SnSbDP8tzDEbaj/u YfBknCWKcPY4HkprEUI4wCEEiOL1iFMEbvZK6WbIH040xortuULl0JdcJMI= Cc: Pratyush Anand , Kees Cook , Arnd Bergmann , Ard Biesheuvel , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Tejun Heo , akpm@linux-foundation.org, Linus Torvalds , Ingo Molnar , Guenter Roeck , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" gcc warns when MODULES_VADDR/END is defined to the same value as VMALLOC_START/VMALLOC_END, e.g. on x86-32: fs/proc/kcore.c: In function ‘add_modules_range’: fs/proc/kcore.c:622:161: error: self-comparison always evaluates to false [-Werror=tautological-compare] if (/*MODULES_VADDR != VMALLOC_START && */MODULES_END != VMALLOC_END) { The code is correct as it is required for most other configurations. The best workaround I found for shutting up that warning is to make it a little more complex by adding a temporary variable. The compiler will still optimize away the code as it finds the two to be identical, but it no longer warns because it doesn't condider the comparison "tautological" any more. Signed-off-by: Arnd Bergmann --- fs/proc/kcore.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 45629f4b5402..c503ad657c46 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -620,12 +620,14 @@ static void __init proc_kcore_text_init(void) /* * MODULES_VADDR has no intersection with VMALLOC_ADDR. */ -struct kcore_list kcore_modules; +static struct kcore_list kcore_modules; static void __init add_modules_range(void) { - if (MODULES_VADDR != VMALLOC_START && MODULES_END != VMALLOC_END) { - kclist_add(&kcore_modules, (void *)MODULES_VADDR, - MODULES_END - MODULES_VADDR, KCORE_VMALLOC); + void *start = (void *)MODULES_VADDR; + size_t len = MODULES_END - MODULES_VADDR; + + if (start != (void *)VMALLOC_START && len != VMALLOC_END - VMALLOC_START) { + kclist_add(&kcore_modules, start, len, KCORE_VMALLOC); } } #else