Received: by 10.223.164.202 with SMTP id h10csp388106wrb; Fri, 17 Nov 2017 02:16:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMZcLPbHZ9Z7P0aD9YUTAPuG4fQT30pKwUY2bq0DvV2UuwBzQpCW4Er4f0M2SWYXIqurbtd6 X-Received: by 10.101.78.18 with SMTP id r18mr4622841pgt.289.1510913775245; Fri, 17 Nov 2017 02:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510913775; cv=none; d=google.com; s=arc-20160816; b=BMYWXL8jI/0Ucs14xw6NPH4IdvruhTlBnGf/iKUCNSD97+LzvjvaKPdaF8AwEV42K2 ZIv46G9TPYmfQHA1oxmU0QgIGSvtC32Bu7Hjba4WRLqHxCd7CUGSZpHNQpwkw48Q3ko8 DjEj2sqgK/UDJ1kHw9yp478oAxn+0w8VJXaHj0EC2CIlO5lqV6gpr+MkbCDall9FJHPl 4nO9Jy44theOaeNYz4DYkgMzcHiqmu1f4qS+rHV9wow152P3smW1TNhF2frD24Vo0Fxx V1Sak4g5OE76pRgy9dEx2BgZ/BHu290awDo380MJsLOjgVDhSUKA666TDI9X08+1BhqO 4fQw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=SNEUZgYmq7Yae863wkl4m1IPsCKEq1pc6ZWhqSDkOro=; b=p8bAAPaI3lq5SjWHyZA1BIR6KW6TYtrLEQlfTvQKWYzZcUfSJhqCz81eHOVpf8FZQY IC46R8U4q5YS1Fykg6ceJ6sy6qyIZYvoUMesCxO8zAqw54ywy91eq3br5YEUQ0hfq1X+ BWTMMEO7mnxpmSWk1+fyQxJI/EkrwCdWzyXUWBtS/oki0vXbzFUefdacs+O0hS8BT6TZ /L/MBCXZ4bvv8YN74XxjnGhdop1uEOjqM6a3S/Puhi5NEpStg7WTf8aQ63W4zUK8kRij IFosWiuI+HlqVYnlW8SRvn9O7vRFLfKo2fAXx+vrd5x9TPNnw91a0e0bdetrgIR/LhE6 zryw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=sU5kYOgw; 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 v5si2480815pgc.309.2017.11.17.02.16.02; Fri, 17 Nov 2017 02:16:15 -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; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=sU5kYOgw; 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 S932488AbdKQDxf (ORCPT + 91 others); Thu, 16 Nov 2017 22:53:35 -0500 Received: from ozlabs.org ([103.22.144.67]:52065 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932283AbdKQDxX (ORCPT ); Thu, 16 Nov 2017 22:53:23 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 3ydPNJ4wWcz9s3T; Fri, 17 Nov 2017 14:53:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1510890800; bh=m5V8fSd/Gcwt74aaljudHP+ZpdQ4RfPXwkvscIR+RXU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sU5kYOgwR9wJ2MhdPNVew9jLu3pqZwcMUFuGRitDkmsFJB65WJoNUhxVw37tzhNf/ 7OudZMoo/Ou9QjimDWkihGHne4yVEaeKhSST+WOSY3h7tdWtE8S1CHiuWX+xEozJAs 8y4PUdzVoyDON4j/eJLoDkZ5Z99KRNpGNPtA4e7lCTiB4MV8cXuSkLuqWLrGuXRPUt 1x45ic4hZhMEANghIt/JNPqnBdA0etJfuYx1Ao2qKGWsbScM3/bEQitV+QuhXkalKX hT2NuZ4GuUTE+s2uYH6fyoiao00u2mwm67NCtFmJWzConJBx8Mkh6rT7asWsdLJ84s sCvuyjdRWI7xg== Date: Fri, 17 Nov 2017 14:53:20 +1100 From: Stephen Rothwell To: Michal Hocko , Andrew Morton Cc: Arnd Bergmann , Linux-Next Mailing List , Linux Kernel Mailing List Subject: Re: linux-next: build warning after merge of the akpm-current tree Message-ID: <20171117145320.714972ca@canb.auug.org.au> In-Reply-To: <20171117094439.5287c715@canb.auug.org.au> References: <20171113164206.187a790d@canb.auug.org.au> <20171113080955.zcdzx2p5kzoa4d7s@dhcp22.suse.cz> <20171117094439.5287c715@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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): 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)); ^ -- Cheers, Stephen Rothwell From 1584299254537368356@xxx Fri Nov 17 07:58:28 +0000 2017 X-GM-THRID: 1583928351761700407 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread