Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp356621imm; Sat, 1 Sep 2018 05:14:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbslAr5J5JF/RTWkYGJ9wN+yOAcwnWXX6wvkbnzBgvRYtvoPzgjyrwoXPB36gojSFnTT6aC X-Received: by 2002:a62:990f:: with SMTP id d15-v6mr20563123pfe.162.1535804099560; Sat, 01 Sep 2018 05:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535804099; cv=none; d=google.com; s=arc-20160816; b=uSG6fFRFXHvyNIiU2tjHWnAuOhX7DIRqgkT7o2Cb/e/UGmVUCwaESlo2mi7WVPMk75 kGr7Qy0nfEWIB+Qb5pwD/NoEaQaBj0RCBQIqlMTJCk6nWy/gnlxsHwxVo64lPYn3K95X 6kCkkDKa3t2hmB9sF5Bq407XdInNHBukJITpDHt5tnZnvYw0P0bD8G+iT1EuU6RqEtnv DwkidVNajZdd3QiWRztPTqmMa4CO45g9SHwvrl9hjTw+PHIz0sUJI83lQPy1BYdt8VDA ybTzOjBaOBwITSRWSdLPAywEs1box787tWMFeT51PU9fBwrMaodRERZ+gQy0A7+vllV0 OYmg== 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 :arc-authentication-results; bh=sMr3dAP+bUmWzlY9z8YGxCFK8ma18tf1A6rP6051FgU=; b=YbO7LF+SZezugIoIml4fmQ5QJ6Ai7TRcbfCUEFjqGnMDj1eAU3EQoe5dhGv2K63m0i ewm3mwFJ+n4iMU6jHfLx03mTzxF9PJsTHD1DEI9zhMlNEBrJw8hfoAiN3l5ckCaG22xN tTpeTHXHPpNjuQgMpREsJDAso9BL3Y8kW+9mE4I1D3MPxV77SLKLTpYecjL06TFT0HsT 7/ImRd2pl4yLGi8gUwM2J1DT9ol8XSsVQus/w/nQveb4xajnlpok1kjdsdAEuplDr9PY AF0eVhXh62NdJB6bUyeOWotH+W6vfvx+H8hqJ8bSLsr/fL0+YaB/Iv/TdaKVXwtb/CB1 wgBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qh0/rviA"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si12366466pgj.391.2018.09.01.05.14.44; Sat, 01 Sep 2018 05:14:59 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qh0/rviA"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727464AbeIAQYK (ORCPT + 99 others); Sat, 1 Sep 2018 12:24:10 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:37361 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726991AbeIAQYK (ORCPT ); Sat, 1 Sep 2018 12:24:10 -0400 Received: by mail-qt0-f195.google.com with SMTP id n6-v6so17409717qtl.4 for ; Sat, 01 Sep 2018 05:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sMr3dAP+bUmWzlY9z8YGxCFK8ma18tf1A6rP6051FgU=; b=qh0/rviApsYIFuZigGI8KmW801ttK6MI5foNZCZ7A3dRpporwplZez7fxw0zn4r/aE r2foeHjYUIEFlTo3wiiAeQSUsUjADMTpg7OP6wWrXalVSenAw9CaOFwIuLpDgUWJ1h6C OjAnTmpT+g+3z4xbGvm+DuGtBvVB4fJAzCztIMR1VXyVtboF8EXu5T4auQY1XushhzNp 4EB9+OuqQvZElZy8JQCHeguYFR0eJT7JgKTsyPnIhSlOv98phjbcGxb2uQxc/18iWfPi RGWZ4S8+9WBmFPyiXuoob+bW+oE6gF1rEGdWyVrTfPOps5l3juSNdy8kAe9Dvvz/Tgik BEUw== 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=sMr3dAP+bUmWzlY9z8YGxCFK8ma18tf1A6rP6051FgU=; b=tTsm6eRNtzi0dH56OH2k/vBHzMs2VDrcgYFnrLx9Pih3pzr4iGOIOAwJlbEo0p/40J o9O7gjwX2qlSIgxLNaVwFmg8UUqETlrIIK8ezOd3VPEJX3nQXJyJ4Gd6Mcdwy3iuhslz unn3CUpGkJ3iiP7WiDUBFS8sya9QDvhnHPM93OqnuUV+8JBOZnlrQPmV0RgaAYxzCVh4 vPTvXw+D7xXo4O4hLmIGegj1X9li5D3N//5tarrt0jRw0nFLOFdTX3KMkEuWY2GVG+I0 lJXlh0KTlsAMsDnJviFkYyBHMopCPwjLkJWQWxjiWDbZGoUTkiMskJxkNKuB9Ff95ZIz NeTA== X-Gm-Message-State: APzg51DhgbQ4buBhUmKBIP9OssrDfIL+cO/nlSjx+BbJU98odtDbHk/e A7LwnBEip42vnECZsEH5xSEUjNE6uug1qkBsgos= X-Received: by 2002:ac8:4304:: with SMTP id z4-v6mr19022501qtm.295.1535803939607; Sat, 01 Sep 2018 05:12:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aed:2291:0:0:0:0:0 with HTTP; Sat, 1 Sep 2018 05:11:59 -0700 (PDT) In-Reply-To: <20180901091738.73dzegdenvla5crf@ltop.local> References: <20180831170514.24665-1-miguel.ojeda.sandonis@gmail.com> <20180831170514.24665-4-miguel.ojeda.sandonis@gmail.com> <20180901091738.73dzegdenvla5crf@ltop.local> From: Miguel Ojeda Date: Sat, 1 Sep 2018 14:11:59 +0200 Message-ID: Subject: Re: [PATCH 4/7] Compiler Attributes: homogenize __must_be_array To: Luc Van Oostenryck Cc: Linus Torvalds , linux-kernel , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Arnd Bergmann , Greg Kroah-Hartman , Masahiro Yamada , Joe Perches , Dominique Martinet , Nick Desaulniers 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 Hi Luc, On Sat, Sep 1, 2018 at 11:17 AM, Luc Van Oostenryck wrote: > On Fri, Aug 31, 2018 at 07:05:11PM +0200, Miguel Ojeda wrote: >> Different definitions of __must_be_array: >> >> * gcc: disabled for __CHECKER__ >> diff --git a/include/linux/compiler.h b/include/linux/compiler.h >> index e0e55eb3f242..e4a702f99e50 100644 >> --- a/include/linux/compiler.h >> +++ b/include/linux/compiler.h >> @@ -357,4 +357,11 @@ static inline void *offset_to_ptr(const int *off) >> compiletime_assert(__native_word(t), \ >> "Need native word sized stores/loads for atomicity.") >> >> +#ifdef __CHECKER__ >> +#define __must_be_array(a) 0 >> +#else >> +/* &a[0] degrades to a pointer: a different type from an array */ >> +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) >> +#endif >> + >> #endif /* __LINUX_COMPILER_H */ > > You can also remove the #ifdef __CHECKER__ because: > 1) even ancient version of sparse don't have a problem > 2) BUILD_BUG_ON_ZERO() is currently disabled for __CHECKER__ > Nice catch! Will do. Cheers, Miguel