Received: by 10.223.164.202 with SMTP id h10csp3009707wrb; Mon, 13 Nov 2017 00:24:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMaa9vbybBdtSdCHLkJd1EXVejQjp4UeFg/VgiGSKaZU+ZdMSRhu28TTTRM5ckbRtGw4daKZ X-Received: by 10.99.108.66 with SMTP id h63mr1889284pgc.362.1510561491956; Mon, 13 Nov 2017 00:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510561491; cv=none; d=google.com; s=arc-20160816; b=zf0wlLpT9N0q5Y4sv3SR8Hw1TjY1bmVcvD5s8EyiwVzsPm4Bd3mpWnCh4Ck9PsNYWG aQrRLnEGNj8UL3RGZFqvqvqtXp+SRLwi7mP3RnFkaZVksC+uf2rIiWvo5a4U0VBAsu+l 5+1UrT3tnM6Uze3V+bHN7axZHamPqylmzjLBAJdQyQCFWYuQXkRr1zf1DdDhRM63b9al +d1EuqBZ9olvhcWCZA+6S2BPj5Zwg+SYyehIedZYb+Qp72Jmw6PiDQBKwSUG22vy5MTF EXRYUQyIGeVELCgocO/Pdek2o8dadMzdfsDNEwZqmlxXCIRbTO2/5v6qaPl4ACdyyc95 uYQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1tcmErx8dQ+Mk7ofvAfcPLwFoZjtQvOFHJiN6n3asi4=; b=gzK0AOocn8ybPq70P2bQEjCoQj6qvShWwJiZ6xRLNNz7vNRVsudfiQPbjASsJMu6Wf f4yvFi+2kxpSmzYbJhkNu5a9v6vj/kMLMeJASa88w5BdIp6PyNu9SYT0W2hmoBexM1Gd 4xw/Lh3xonIysBD2WwVs+3Fw21xtNV9PddrMTkmXw1t0isdxAbRUTBIy93KsF59zxhH2 z8egpUV6BwUEXSFwz1454EEisnPuRVEyhlnevjlwqmeD1Jci4C/kXydgLKyeK61XI9Ds zZofDATkUjBvuZYi9hjPjXHBveigeRB6cih0igVvtFmpgpZvG5dgmcfJmPR7WD4TG20O b3cw== 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 11si1897224plb.316.2017.11.13.00.24.38; Mon, 13 Nov 2017 00:24:51 -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 S1751978AbdKMIYB (ORCPT + 91 others); Mon, 13 Nov 2017 03:24:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:58013 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261AbdKMIYA (ORCPT ); Mon, 13 Nov 2017 03:24:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1AFDFAB09; Mon, 13 Nov 2017 08:23:59 +0000 (UTC) Date: Mon, 13 Nov 2017 09:23:58 +0100 From: Michal Hocko To: Stephen Rothwell Cc: Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List Subject: Re: linux-next: build warning after merge of the akpm-current tree Message-ID: <20171113082358.w34pdipoeels47xc@dhcp22.suse.cz> References: <20171113164206.187a790d@canb.auug.org.au> <20171113080955.zcdzx2p5kzoa4d7s@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171113080955.zcdzx2p5kzoa4d7s@dhcp22.suse.cz> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 13-11-17 09:09:55, Michal Hocko wrote: > On Mon 13-11-17 16:42:06, Stephen Rothwell wrote: > > Hi Andrew, > > > > 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? Strange I played with the following minimal test case and it warns only for the explicit &m use while n is clearly never null as well. This all smells like -Waddress is just confused (at least with my gcc 7.2.0-12 #include #define MAX_NUMNODES 10 struct mask { void *bits; }; #define nodemask_pr_args(maskp) (maskp) ? MAX_NUMNODES : 0, (maskp) ? (maskp)->bits : NULL int foo(void) { struct mask m; struct mask *n = &m; printf("%*p\n", nodemask_pr_args(&m)); printf("%*p\n", nodemask_pr_args(n)); return 0; } -- Michal Hocko SUSE Labs From 1583937705832797595@xxx Mon Nov 13 08:11:48 +0000 2017 X-GM-THRID: 1583928351761700407 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread