From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751176AbdKTLdY (ORCPT ); Mon, 20 Nov 2017 06:33:24 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:44021 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdKTLdW (ORCPT ); Mon, 20 Nov 2017 06:33:22 -0500 X-Google-Smtp-Source: AGs4zMaCKTZol94nAHbxCCL2I4GH6PrAubVQqHJIjl6T1rJoox3PRorBKKa95LEN9YLRqNvNI3YL+RE2SRZkBjkODtU= MIME-Version: 1.0 In-Reply-To: <20171120082239.irwzcrxkfu3qggbh@dhcp22.suse.cz> References: <20171117101545.119689-1-arnd@arndb.de> <20171120082239.irwzcrxkfu3qggbh@dhcp22.suse.cz> From: Arnd Bergmann Date: Mon, 20 Nov 2017 12:33:20 +0100 X-Google-Sender-Auth: EoJ4oQyIVNJYr6rTJFPs7v0nmw8 Message-ID: Subject: Re: [PATCH] mm: fix nodemask printing To: Michal Hocko Cc: Andrew Morton , Stephen Rothwell , Linux-Next Mailing List , Linux Kernel Mailing List , Zhangshaokun Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vAKBXSNc000979 On Mon, Nov 20, 2017 at 9:22 AM, Michal Hocko wrote: > On Fri 17-11-17 11:15:45, Arnd Bergmann wrote: >> 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 > > Thanks for the fixup. It is sad how a questionable warning makes the > code worse... Does it make sense to have the warning enabled? > Gcc bug [1] suggests there is no great interest into fixing it. > > Anyway to the patch > Acked-by: Michal Hocko > > [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82963 I think I found some real bugs when I started seeing that warning elsewhere, so I'd rather keep it enabled in general. I'd still agree that the gcc behavior in macros is questionable though, in particular since they decided to stop warning for the "!= NULL" case. I've found the commit that changed gcc-7 behavior and commented again in the bugzilla, but did not reopen. The inline function was mentioned in bugzilla there[2] as the preferred workaround. Arnd [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48778