[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mErSGjR4aLRQdKfUEWX8rDsnaqkb4Cse8gjxs-5PzBdw@mail.gmail.com>
Date: Sat, 1 Sep 2018 14:11:59 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Eli Friedman <efriedma@...eaurora.org>,
Christopher Li <sparse@...isli.org>,
Kees Cook <keescook@...omium.org>,
Ingo Molnar <mingo@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Joe Perches <joe@...ches.com>,
Dominique Martinet <asmadeus@...ewreck.org>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH 4/7] Compiler Attributes: homogenize __must_be_array
Hi Luc,
On Sat, Sep 1, 2018 at 11:17 AM, Luc Van Oostenryck
<luc.vanoostenryck@...il.com> 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
Powered by blists - more mailing lists