Received: by 10.223.164.202 with SMTP id h10csp828303wrb; Fri, 17 Nov 2017 09:15:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMafulaQIzx3KsjSDXy/Lm5pNob/l3OaVF83/Nbaz1JNrXPyFMjHN//JqyOsS7TRGeDnd+Sq X-Received: by 10.99.146.76 with SMTP id s12mr5895406pgn.354.1510938907435; Fri, 17 Nov 2017 09:15:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510938907; cv=none; d=google.com; s=arc-20160816; b=STnXMtiUR6iPm+u/QkChWONqxUck9YIP3FxSDy/1fK2aoZJYQq3X+tWWaxJpMwj3yD vq49lrjEDtpjHq+iuyU4tiCV6qSxqUM13PFfwaNuW9Yzc67T/J/+ALghZzaz4BVDea0A btXDneTpc61UEMF748qV1Y0sEDYYZDlmGK+UAT16hvcU9yZH/Mi9lOcHGgWFFl5TTkSA ybF4zsnz83y6D0gUkW8nSJATZF9OT9vYSYj6KZhiDcDHGt4TQap7VLAwk+4Tltx/3eTn Aa7n96gEkrAXC0Hwte9Y0UPiJyxAE++R1jjYdcNmrh13dVjpKZf6315KyR6V0F7VbSIT NnkQ== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=yRrblBk6dfWWQzgpPzknrBQjBPVlvPcTEFU5iMcu9e4=; b=cKgGdgWZ3MkBo+LNiuft+mgLLXLymEcA6ggdtux3TQE/6XCl7bcfCA0lqYcUTRNRcp M48aTthBZw5sLUohd10LnIXMK+akTXEqo7nNdzeSwnH6KXXrdo2SD/goL2uxhOO9ifrb y5l81dZckRpegQODUmpSFv8Zryzg2tr3uOazUk0EKo0Ns2LTgAP7bKtIhfjQom+1piBt 5VUH9YX3aWb//odByjZ3bSrMGhIEHfFRePyGLhAyBbIJVRZ9k0hwT3yZoIF7wGqEoCVM UC/wbMqWgJaqijl2IEgeBGudc9M1EPFuZ5lpU/Kg0wvU8vdC2JpKkrE1l3WmuCp4XoBF AS7A== 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 i62si938482pli.604.2017.11.17.09.14.54; Fri, 17 Nov 2017 09:15:07 -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 S1751518AbdKQJhq (ORCPT + 91 others); Fri, 17 Nov 2017 04:37:46 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11007 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbdKQJhn (ORCPT ); Fri, 17 Nov 2017 04:37:43 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DLD27309; Fri, 17 Nov 2017 17:37:34 +0800 (CST) Received: from [127.0.0.1] (10.74.221.148) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Fri, 17 Nov 2017 17:36:59 +0800 Subject: Re: linux-next: build warning after merge of the akpm-current tree To: Stephen Rothwell , Michal Hocko , Andrew Morton References: <20171113164206.187a790d@canb.auug.org.au> <20171113080955.zcdzx2p5kzoa4d7s@dhcp22.suse.cz> <20171117094439.5287c715@canb.auug.org.au> <20171117145320.714972ca@canb.auug.org.au> CC: Arnd Bergmann , Linux-Next Mailing List , Linux Kernel Mailing List From: Zhangshaokun Message-ID: <24a5b70c-aac4-29b5-6a4d-38ac3d10d475@hisilicon.com> Date: Fri, 17 Nov 2017 17:36:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20171117145320.714972ca@canb.auug.org.au> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.221.148] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5A0EADDE.00F6,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e98dbd9ad18e17d23b34cca0e910938a Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2017/11/17 11:53, Stephen Rothwell wrote: > Hi all, > > On Fri, 17 Nov 2017 09:44:39 +1100 Stephen Rothwell wrote: >> >> On Mon, 13 Nov 2017 12:43:08 +0100 Arnd Bergmann wrote: >>> >>> On Mon, Nov 13, 2017 at 9:09 AM, Michal Hocko wrote: >>>> On Mon 13-11-17 16:42:06, Stephen Rothwell wrote: >>>>> >>>>> After merging the akpm-current tree, today's linux-next build (powerpc >>>>> ppc64_defconfig) produced this warning: >>>>> >>>>> In file included from include/linux/mmzone.h:17:0, >>>>> from include/linux/mempolicy.h:10, >>>>> from mm/mempolicy.c:70: >>>>> mm/mempolicy.c: In function 'mpol_to_str': >>>>> include/linux/nodemask.h:107:41: warning: the address of 'nodes' will always evaluate as 'true' [-Waddress] >>>>> #define nodemask_pr_args(maskp) (maskp) ? MAX_NUMNODES : 0, (maskp) ? (maskp)->bits : NULL >>>>> ^ >>>>> mm/mempolicy.c:2817:11: note: in expansion of macro 'nodemask_pr_args' >>>>> nodemask_pr_args(&nodes)); >>>>> ^ >>>> >>>> Hmm, this warning is quite surprising to me. Sure in this particular >>>> case maskp will always be non-NULL so we always expand to >>>> MAX_NUMNODES, maskp->bits >>>> which is what we want. But we have other users which may be NULL. Does >>>> anybody understan why this warns at all? >>> >>> As I understand it, the warning tries to address a common typo of accidentally >>> testing the pointer to a stack object for being non-NULL, rather than the object >>> pointed to for being non-zero. >>> >>> Adding an extra '!= NULL' comparison gets rid of the warning for me: >>> >>> #define nodemask_pr_args(maskp) \ >>> ((maskp) != NULL) ? MAX_NUMNODES : 0, \ >>> ((maskp) != NULL) ?(maskp)->bits : NULL >>> >>> Arnd >> >> This warning now exists in Linus' tree :-( > > Looking closer, it seems that the above workaround doesn't work for my > compiler (gcc v5.2.0): > I also came across this issue using Linus' tree and my gcc is gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.5). CC drivers/clk/renesas/rcar-gen3-cpg.o In file included from ./include/linux/mmzone.h:17:0, from ./include/linux/mempolicy.h:10, from mm/mempolicy.c:70: 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] ((maskp) != NULL) ? MAX_NUMNODES : 0, \ ^ mm/mempolicy.c:2817:11: note: in expansion of macro �nodemask_pr_args� nodemask_pr_args(&nodes)); ^ ./include/linux/nodemask.h:109:11: warning: the comparison will always evaluate as �true� for the address of �nodes� will never be NULL [-Waddress] ((maskp) != NULL) ? (maskp)->bits : NULL ^ mm/mempolicy.c:2817:11: note: in expansion of macro �nodemask_pr_args� nodemask_pr_args(&nodes)); ^ CC drivers/clk/renesas/renesas-cpg-mssr.o Thanks, Shaokun > In file included from include/linux/mmzone.h:17:0, > from include/linux/mempolicy.h:10, > from mm/mempolicy.c:70: > 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] > ((maskp) != NULL) ? MAX_NUMNODES : 0, \ > ^ > mm/mempolicy.c:2817:11: note: in expansion of macro 'nodemask_pr_args' > nodemask_pr_args(&nodes)); > ^ > include/linux/nodemask.h:109:11: warning: the comparison will always evaluate as 'true' for the address of 'nodes' will never be NULL [-Waddress] > ((maskp) != NULL) ? (maskp)->bits : NULL > ^ > mm/mempolicy.c:2817:11: note: in expansion of macro 'nodemask_pr_args' > nodemask_pr_args(&nodes)); > ^ > From 1584307922850336279@xxx Fri Nov 17 10:16:15 +0000 2017 X-GM-THRID: 1583928351761700407 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread