Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp839555imu; Fri, 16 Nov 2018 11:03:36 -0800 (PST) X-Google-Smtp-Source: AJdET5ftiCVv8f6GzqEVlbknGspAQq/dEsLAqK+R2SaLN4ZrHLkl+WAVTGYsb8hkuW0S9BCkeYRH X-Received: by 2002:a63:2222:: with SMTP id i34mr10169049pgi.83.1542395016009; Fri, 16 Nov 2018 11:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542395015; cv=none; d=google.com; s=arc-20160816; b=qQoST8h6/JbHTc970UCQR6A0dKgO+zw/ZWRGqRMV4sC9/7lTMcM+cEnAgBbW/8io2x Em+nqrs+PZwI9KuhZ9z32tylltNwJp7IeWI2WQIuUJpvqR6ct+DTm2DuhLonedoAUcVJ myeiIhL5B/i1wU8tEnppZdtqYUTkDzYsPthT4dBAES0zWXDzSPLMqyHapFRclo+roUFP jCiqOmboKskuHZkyJcZO2EK7yvUPQtyprGrvCT6XQ8br8fO+ocagtQezpTnBiCNeaXOt eDdxion2/LLqR1hUSSip0SPJUDJpMUn4JBzyXBhNxIfz0km1AS2Kmv5sgYYXC9i9Xfdz yopQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=4AYGeaWa6i+JNpi+TyxAIosr4WOo3bTeAHYBkctwvLo=; b=JsHc3TkuQZ3KwUbic4u4NQfPtaNJvh+BpdL6Bpy3JhdLknCEA7f7GHs+xgjSJqSzdv hwX3Br+A13vadIkEQ5zK8kvzOND655+Qlnyf9iUkmpwTZUBKmo4HOvlLtzvWfdDUVDVE KVImuaJ6JYGFtwxkjG81VlsM3oablEwl2IB+4JT65e9NKjVejyTyhPNpnVi8CQXOahQl aME0FVRb/WIYoz0dDk1E4ZW3/GM4RbXNNeMgwb9ZVsVjFettu2mjC29SWh9tntukgtLb baPFzVUZNz4aGAGwWmeiNIUFF1kUDCqdOPv5Oxh2TLFDhwDiOD3V4GCFAOfebvFjNi58 duxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Gy8JWsRU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si10173446pfn.111.2018.11.16.11.03.20; Fri, 16 Nov 2018 11:03:35 -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=@chromium.org header.s=google header.b=Gy8JWsRU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbeKQFPI (ORCPT + 99 others); Sat, 17 Nov 2018 00:15:08 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:45872 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbeKQFPI (ORCPT ); Sat, 17 Nov 2018 00:15:08 -0500 Received: by mail-yw1-f65.google.com with SMTP id p18-v6so10456768ywg.12 for ; Fri, 16 Nov 2018 11:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4AYGeaWa6i+JNpi+TyxAIosr4WOo3bTeAHYBkctwvLo=; b=Gy8JWsRUvel9IFCMw2IZrQqJ+NVl/cfcVfjMOPI9SnwkwRfe7mxw26HdICOsSmO+25 M9kr4f1oufD24aJWabhie9Ob5Pjj9dhdQ+6KK79aT+qoMLKhyrkYPeJzR6D+Evy0TF5w n7Y6sGW4DTgYIPFG/RfDjfSRrN9f6RUQuAmlw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4AYGeaWa6i+JNpi+TyxAIosr4WOo3bTeAHYBkctwvLo=; b=I+gFi3G2vBzzupA9plXvAh7GUDDCPKUTmOlTnyuwTJNfD0WSn90ij8s3SsXzpAgqLH eKqjG/MGXYfpTjAk4faUfYIa7hxqkLZzNTqc0MCprXlI2PO0ZknixcFgCVM3haSc4aY2 sAlxpR2+/fmwIJbCw1H0884jypqTCrVvwgg2zV6er+qLGYKmD0Haki4eHTcAC/UFvzQ5 aIrtR0iPH4qTUEEvbgLguJCBvJHA8jg5Tgj1F/fEi4Sa9pWz5SN4/6Lnd0eq/QUmvmuQ T8Udv+JMUBM8RYic4UA3d3WAXwqxKeFYh8CFu99nEtfxwgWN84z2JvSNL/AD1uIIaXJa zH9A== X-Gm-Message-State: AGRZ1gLuR9vMOQGNiN0L+dUVvTKymUkV9wQvnWzb+Q5d+aFT+cFuXkFh bzjzr35aH19WQVLTXQI5dnOcP6fGmWI= X-Received: by 2002:a81:4a42:: with SMTP id x63-v6mr11790161ywa.3.1542394891513; Fri, 16 Nov 2018 11:01:31 -0800 (PST) Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com. [209.85.219.176]) by smtp.gmail.com with ESMTPSA id h82-v6sm12946041ywh.17.2018.11.16.11.01.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 11:01:30 -0800 (PST) Received: by mail-yb1-f176.google.com with SMTP id i17-v6so10141417ybp.13 for ; Fri, 16 Nov 2018 11:01:30 -0800 (PST) X-Received: by 2002:a25:7643:: with SMTP id r64-v6mr11512126ybc.403.1542394889964; Fri, 16 Nov 2018 11:01:29 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:b906:0:0:0:0:0 with HTTP; Fri, 16 Nov 2018 11:01:29 -0800 (PST) In-Reply-To: <1542349645-8852-2-git-send-email-yamada.masahiro@socionext.com> References: <1542349645-8852-1-git-send-email-yamada.masahiro@socionext.com> <1542349645-8852-2-git-send-email-yamada.masahiro@socionext.com> From: Kees Cook Date: Fri, 16 Nov 2018 13:01:29 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] build_bug.h: remove all dummy BUILD_BUG_ON stubs for sparse To: Masahiro Yamada Cc: Andrew Morton , Linus Torvalds , Arnd Bergmann , Nick Desaulniers , Miguel Ojeda , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 16, 2018 at 12:27 AM, Masahiro Yamada wrote: > The introduction of these dummy BUILD_BUG_ON stubs dates back to > commit 903c0c7cdc21 ("sparse: define dummy BUILD_BUG_ON definition > for sparse"). At that time, BUILD_BUG_ON() was implemented with the > negative array trick, which Sparse complains about even if the > condition can be optimized and evaluated to 0 at compile-time. > > With the previous commit, the leftover negative array trick is gone. > Sparse is happy with the current BUILD_BUG_ON(), which is implemented > by using the 'error' attribute. > > There might be a little room for argument about BUILD_BUG_ON_ZERO(). > Sparse reports 'invalid bitfield width, -1' for non-zero value, > and 'bad integer constant expression' for non-constant value. > This is the same criteria as GCC uses. So, if those Sparse errors > occurred, they would cause errors for GCC as well. (Hence, such > errors would have been detected by the normal compile test process.) > > Signed-off-by: Masahiro Yamada Acked-by: Kees Cook -Kees > --- > > Changes in v2: > - Fix a coding style error (two consecutive blank lines) > > include/linux/build_bug.h | 12 ------------ > 1 file changed, 12 deletions(-) > > diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h > index d415c64..6625c88 100644 > --- a/include/linux/build_bug.h > +++ b/include/linux/build_bug.h > @@ -4,16 +4,6 @@ > > #include > > -#ifdef __CHECKER__ > -#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) > -#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) > -#define BUILD_BUG_ON_ZERO(e) (0) > -#define BUILD_BUG_ON_INVALID(e) (0) > -#define BUILD_BUG_ON_MSG(cond, msg) (0) > -#define BUILD_BUG_ON(condition) (0) > -#define BUILD_BUG() (0) > -#else /* __CHECKER__ */ > - > /* Force a compilation error if a constant expression is not a power of 2 */ > #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ > BUILD_BUG_ON(((n) & ((n) - 1)) != 0) > @@ -64,6 +54,4 @@ > */ > #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") > > -#endif /* __CHECKER__ */ > - > #endif /* _LINUX_BUILD_BUG_H */ > -- > 2.7.4 > -- Kees Cook