From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826AbdKQKQU (ORCPT ); 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 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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(-) 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 -- 2.9.0