Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753812AbdGNJ30 (ORCPT ); Fri, 14 Jul 2017 05:29:26 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:62117 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753492AbdGNJ3T (ORCPT ); Fri, 14 Jul 2017 05:29:19 -0400 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Jiri Olsa Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , Kees Cook , Ingo Molnar , Laura Abbott , Pratyush Anand , Ard Biesheuvel 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1649 Lines: 44 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 -- 2.9.0