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: 9840295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2882602BD for ; Fri, 14 Jul 2017 09:29:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C36E32876A for ; Fri, 14 Jul 2017 09:29:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B80B328777; Fri, 14 Jul 2017 09:29:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49F762876A for ; Fri, 14 Jul 2017 09:29:16 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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