Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Zhangshaokun <zhangshaokun@hisilicon.com>
Subject: Re: [PATCH] mm: fix nodemask printing
Date: Mon, 20 Nov 2017 12:33:20 +0100
Message-ID: <CAK8P3a2uUF1oR0c2+9v_RSTiepE7Ber2QfxJK-SuXV9ES41CTw@mail.gmail.com> (raw)
In-Reply-To: <20171120082239.irwzcrxkfu3qggbh@dhcp22.suse.cz>

On Mon, Nov 20, 2017 at 9:22 AM, Michal Hocko <mhocko@kernel.org> 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 <arnd@arndb.de>
>
> 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 <mhocko@suse.com>
>
> [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

      reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13  5:42 linux-next: build warning after merge of the akpm-current tree Stephen Rothwell
2017-11-13  8:09 ` Michal Hocko
2017-11-13  8:23   ` Michal Hocko
2017-11-13 11:43   ` Arnd Bergmann
2017-11-13 11:54     ` Michal Hocko
2017-11-13 12:24       ` Arnd Bergmann
2017-11-13 12:29       ` Michal Hocko
2017-11-16 22:44     ` Stephen Rothwell
2017-11-17  3:53       ` Stephen Rothwell
2017-11-17  9:36         ` Zhangshaokun
2017-11-17  9:56         ` Arnd Bergmann
2017-11-17 10:15           ` [PATCH] mm: fix nodemask printing Arnd Bergmann
2017-11-20  8:22             ` Michal Hocko
2017-11-20 11:33               ` Arnd Bergmann [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a2uUF1oR0c2+9v_RSTiepE7Ber2QfxJK-SuXV9ES41CTw@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=zhangshaokun@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git