From patchwork Fri Nov 17 10:15:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 119146 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp329677qgn; Fri, 17 Nov 2017 02:16:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMZmYVW22Uar1JZqQX5juLg9/KxGF5yFTkHtTDOaNmxMrf78LSeSqTg1QPo/P8KhdsffEa5i X-Received: by 10.98.16.66 with SMTP id y63mr1544419pfi.192.1510913782679; Fri, 17 Nov 2017 02:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510913782; cv=none; d=google.com; s=arc-20160816; b=h9fThDjH9dR30vYanti/p34Yvpk/q+xYAITfWTQkCnKWsxgcw3vuN2Mm9xsx68toTA kwjRbMUzLs9CfYIY844cSyqIMjPZJshWq1i8VCTh3r6hhhcfMd7pbO8TAGK8z/MQ5u5G pXgJ7BtAVikITymuPv1q72zxqMnZiXBqLsBGX3D16HkukiWdO1eYeEkKQQ+NYWTb/pRf 1pbVOnCljEaBwqDz7Krk0dcT0NmGdldfuzvgjpGAw1qJ6hOM3U6Zg2U5+2jpG7pT5WTx oSCoGEdW6dpsL2yPdItGcIUI0Rtkld5UavrxVKYmZSnM6Bf3zkvfIDtUtlCzQxRKbsV/ CQUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tPkw8C7pIRuxp0Qn0WwRUQCqMVl5D7zF1tRRxhtIDuE=; b=X+4C5mOhpwFkuesfXagboQYedVHbw3JoBsqv86ehwg89r5zKoXycE4i7SDaB3Q2MMa wvmBMGUHTczxTxmFBQQywqGH2AoEu7bpolTt3+yt56ez92lbvqJ/2VP6X1Jwgn1k1tRx LJ7cyfgcPF2/VkHj8W/KCkzJiHMNIYCzxBlpr+vLbGW7ufeB/ayulZOjecd7EJPVJ1DG XBYbkxgk3eu+N0g3tE506Mennzo9YgtWz9F1UPIeOyl5gFk9cq8jnXeIgMIQ96xf8R7M mctj1eSHf3P9qOb3hj1FR7xAmjfh3v5EbaSgiIjzoDiBmU1K6HDmRNho/8AeX92qHZT/ rnpg== 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 14si2560429pla.742.2017.11.17.02.16.22; Fri, 17 Nov 2017 02:16:22 -0800 (PST) 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 S1752827AbdKQKQU (ORCPT + 28 others); Fri, 17 Nov 2017 05:16:20 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:64054 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbdKQKQJ (ORCPT ); Fri, 17 Nov 2017 05:16:09 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MasOo-1eUYyN3dW6-00KQhk; Fri, 17 Nov 2017 11:15:57 +0100 From: Arnd Bergmann To: Andrew Morton Cc: Michal Hocko , Stephen Rothwell , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Zhangshaokun , Arnd Bergmann Subject: [PATCH] mm: fix nodemask printing Date: Fri, 17 Nov 2017 11:15:45 +0100 Message-Id: <20171117101545.119689-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K0:NHhaHIktuBq0De3pJisyn5zDB14alzueYrG3Y9ZPvlpuBu0tKPO lZFS6xlxU0fJGN2SSuVl20SROnjzOqyv16Fc0RLGmcqTBFQWVNEEE3jCVZ2p3OYtJpUx1pE ETAgb5167k1I3lS/+AcnwSJKbqWb1mIp7HP+Ub47+rqRBEFXNuX2ctTmFj9EN/YwjkkWDeM 9JXAIy3xrjbCsAA1tGV2A== X-UI-Out-Filterresults: notjunk:1; V01:K0:Cm4wFN/ds/M=:qDZOnQGg0utIYVyOrBf9iZ QuwnXWzuDfqOOgx7mDgWhoKd67Y0bgl57eKWH777T2udBuFs9ymkA+kzj3NIC+VUSoKxr4dq/ rJsB1Vva2gNZHtZ9VntskL2qQkmGVT4j1DmIEzltC5xYIplTMxIwmlODAucFek3Tlmg6dCKME 7O4s1IRMoZduAJMGW5qHjGKYi+E75WWt3cZJeIFoCpxW8HU/nA+zl0KDeK78k7bq3GRiWtRsq 1wxbGo7AJ5SkNo0FcMSXVk6l5y9Wn1u5zrRiX/+g/py8XTQEx8SrK4k71c59F0zvaQTVTELzZ HAtNlIrs5LTbLqrgGTwLnhb/qZ1LzXTsC/gsGsR0bVDIVeO+LzteNBpzCTAM5fgIWzjA5j2Y2 uIM5oYbDDERp3ddjGmqttRXAvXeMAhu7d2qZzP1USYbWSeBJYc1iprVQsyNe/ptyfBrFkfpPT zPkQiENj7m23X3kUeBaKygJME6Wuv4pWMMGhk2MnYJ2bH5gziukW0Z3IiRygjrBcesvvMSzkq qdqz69IePlQdpctCtOMD6ALz/9VHhTSSj6kql0DeVxiSPLzL8RXqnruvx/AY7xEn4deKPEJEI BeNqtJAxPfWJ9iRpTC8TPxzk3tYZCVoBKbHs2GdUKT3Z0O7NciIb5Nzb4vNQ0fhpzTkoIJI2v bfxlruVFZTgq7LWQ+TFo+KV62ldQx3KmSeu7UWhAU5Hc7s43n6GcYF09s5U1m0YTrF4IPR81N XnOy+kknQVga/jn+MjUYViwm8+KkeId2BHSK94srKft0NzCF9h4UrePzTdQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cleanup caused build warnings for constant mask pointers: mm/mempolicy.c: In function ‘mpol_to_str’: ./include/linux/nodemask.h:108:11: warning: the comparison will always evaluate as ‘true’ for the address of ‘nodes’ will never be NULL [-Waddress] An earlier workaround I suggested was incorporated in the version that got merged, but that only solved the problem for gcc-7 and higher, while gcc-4.6 through gcc-6.x still warn. This changes the printing again to use inline functions that make it clear to the compiler that the line that does the NULL check has no idea whether the argument is a constant NULL. Fixes: 0205f75571e3 ("mm: simplify nodemask printing") Signed-off-by: Arnd Bergmann --- I've done only minimal build testing on this, but did check it with all compiler versions this time. --- include/linux/nodemask.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.9.0 Acked-by: Michal Hocko diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 15cab3967d6d..1fbde8a880d9 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -104,9 +104,16 @@ extern nodemask_t _unused_nodemask_arg_; * * Can be used to provide arguments for '%*pb[l]' when printing a nodemask. */ -#define nodemask_pr_args(maskp) \ - ((maskp) != NULL) ? MAX_NUMNODES : 0, \ - ((maskp) != NULL) ? (maskp)->bits : NULL +#define nodemask_pr_args(maskp) __nodemask_pr_numnodes(maskp), \ + __nodemask_pr_bits(maskp) +static inline unsigned int __nodemask_pr_numnodes(const nodemask_t *m) +{ + return m ? MAX_NUMNODES : 0; +} +static inline const unsigned long *__nodemask_pr_bits(const nodemask_t *m) +{ + return m ? m->bits : NULL; +} /* * The inline keyword gives the compiler room to decide to inline, or