Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2742186ybi; Sun, 28 Jul 2019 16:46:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA4hp5aK80p5uPUAkzjL3q4BIz4Ph3dtUbZUC6DhNRkl60nsMsnVvQpYQn7rJK0mqsurCE X-Received: by 2002:a62:1750:: with SMTP id 77mr34013013pfx.172.1564357580867; Sun, 28 Jul 2019 16:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564357580; cv=none; d=google.com; s=arc-20160816; b=cMw+Tko4mzvqYEw42Q5fpzvEsQVPoW5kJueLMHHwiXQ4FgrZNvh+hLFW7UWbyDObJF y89GOhMdyg1iuv+w4HXepWaotHmMaA+wvwkougAy5/lBRAVVbYbcjJBu5qj1D7iy6hiM M9E2u9l7PBVEGPAlJNYnLxxjNNSx5fHRJRcs1nvD34VtL0HZ+OLj4KgTHfXf9c/C2Awp MNT5gonWSXjoudHlJddZf7DJiUo50wGU+lLHLmVZFoXxpN58qnv5G+Ag7Lrn10ByqVP7 4qGfPa3/GXrOItlvEEqbpBOAHv/0O7/bUaxE+q+sbbJdmipqbvWrop3TsurNp3ZRHA7M +1Xw== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=KcAlx4aWUBy3a4REhZ8sp5ll4TNozqE+gdt7Rg4NJ50=; b=BAu5Rsp/hl8gern08WGXpkgyEkg/oJ75Zn3v5x8QBkkQmpZS2xiwsShIFmjcMv/bqB Vm4zEhPjgkXiDjSSTzwEYpAw0gPAQJg5Z69GQl1nihthoeiGvU4TNWiR4EpY6LOodYbc s5EWywox2O/RVIegU8dBfE5BcVJ2iw6A6JUW0Wmjtv84CimSaDpGx3p3wXub6W3Kr76+ Bx4U3j9UA7RG0F0L8FZ3HWVOBTHVXJ4J9ghkxvLqMgjacI4mq5+br9slj8wVr8dU5I5q aW5f0X06VdhTGi/1Y9DeKKubGAiIRiCprLm4NR23V3VP5kNHnfUH9dCDry4xJ1slAsfj ZBig== 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 t27si24239519pgk.502.2019.07.28.16.46.05; Sun, 28 Jul 2019 16:46:20 -0700 (PDT) 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 S1726271AbfG1Xp1 (ORCPT + 99 others); Sun, 28 Jul 2019 19:45:27 -0400 Received: from smtprelay0149.hostedemail.com ([216.40.44.149]:38341 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726203AbfG1Xp1 (ORCPT ); Sun, 28 Jul 2019 19:45:27 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 84D8018224D81; Sun, 28 Jul 2019 23:45:25 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2915:3138:3139:3140:3141:3142:3353:3622:3865:3866:3868:3870:3872:3873:4321:5007:7903:9010:9036:10004:10400:10848:11026:11232:11473:11658:11914:12043:12295:12297:12438:12555:12740:12760:12895:13019:13069:13311:13357:13439:14659:14721:21080:21451:21627:21740:30054:30069:30070:30091,0,RBL:23.242.196.136:@perches.com:.lbl8.mailshell.net-62.8.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: step72_4c54fc21e9006 X-Filterd-Recvd-Size: 2661 Received: from XPS-9350.home (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Sun, 28 Jul 2019 23:45:24 +0000 (UTC) Message-ID: <0306bec0ec270b01b09441da3200252396abed27.camel@perches.com> Subject: Re: [PATCH 00/12] treewide: Fix GENMASK misuses From: Joe Perches To: Rikard Falkeborn , Andrew Morton Cc: johannes@sipsolutions.net, linux-kernel@vger.kernel.org Date: Sun, 28 Jul 2019 16:45:22 -0700 In-Reply-To: <20190727195455.1558-1-rikard.falkeborn@gmail.com> References: <20190727195455.1558-1-rikard.falkeborn@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2019-07-27 at 21:54 +0200, Rikard Falkeborn wrote: > Trimming CC-list. > > > It'd can't be done as it's used in declarations > > and included in asm files and it uses the UL() > > macro. > > Can the BUILD_BUG_ON_ZERO() macro be used instead? It works in > declarations. I don't know if it works in asm-files, but the below > changes builds an x86-64 allyesconfig without problems (after the rest > of this series have been applied. Maybe, fine by me if it works. Perhaps you should submit this and let the build-bot verify it. > /Rikard > > --- > include/linux/bits.h | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/include/linux/bits.h b/include/linux/bits.h > index 669d69441a62..52e747d27f87 100644 > --- a/include/linux/bits.h > +++ b/include/linux/bits.h > @@ -2,6 +2,7 @@ > #ifndef __LINUX_BITS_H > #define __LINUX_BITS_H > > +#include > #include > #include > > @@ -19,11 +20,15 @@ > * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. > */ > #define GENMASK(h, l) \ > + (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ > + __is_constexpr(h) && __is_constexpr(l), (l) > (h), 0)) + \ > (((~UL(0)) - (UL(1) << (l)) + 1) & \ > - (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) > + (~UL(0) >> (BITS_PER_LONG - 1 - (h))))) > > #define GENMASK_ULL(h, l) \ > + (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ > + __is_constexpr(h) && __is_constexpr(l), (l) > (h), 0)) + \ > (((~ULL(0)) - (ULL(1) << (l)) + 1) & \ > - (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h)))) > + (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))) > > #endif /* __LINUX_BITS_H */