Re: [PATCH] compiler.h, sparse, smatch: Do not define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2018-07-06 at 19:31 +0200, Luc Van Oostenryck wrote:
> On Thu, Jul 05, 2018 at 08:57:26AM -0700, Bart Van Assche wrote:
> > Both sparse and smatch identify themselves as gcc. However, neither
> > static analyzer supports any of the __builtin_*_overflow() functions.
> > Hence do not define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW for these
> > static checkers.
> > 
> > Fixes: f0907827a8a9 ("compiler.h: enable builtin overflow checkers and add fallback code")
> > Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx>
> > Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
> > Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> > Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Cc: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> > Cc: <stable@xxxxxxxxxxxxxxx>
> > ---
> >  include/linux/compiler-gcc.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> > index f1a7492a5cc8..15e55b89e952 100644
> > --- a/include/linux/compiler-gcc.h
> > +++ b/include/linux/compiler-gcc.h
> > @@ -344,6 +344,6 @@
> >   */
> >  #define uninitialized_var(x) x = x
> >  
> > -#if GCC_VERSION >= 50100
> > +#if GCC_VERSION >= 50100 && !defined(__CHECKER__)
> >  #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
> >  #endif
> > -- 
> 
> Hi,
> 
> A similar patch has already been posted 2 or 3 weeks ago [1].
> 
> Also, the development version of sparse [2] supports the
> __builtin_*_overflow() functions *and* supports the __has_builtin()
> macro. So I think it's preferable to use __has_builtin(),
> at least for sparse (maybe smatch is interested in it too).
> 
> -- Luc Van Oostenryck
> 
> [1] https://lore.kernel.org/lkml/alpine.LSU.2.21.1806071258310.7958@xxxxxxxxxxxxx/
> [2] git://github.com/lucvoo/sparse.git

Hello Luc,

Thanks, I had missed Miroslav's patch. BTW, which sparse repository do you
recommend that I pull from to obtain a recent and stable version of sparse? The
git://git.kernel.org/pub/scm/devel/sparse/sparse.git repository mentioned on
https://sparse.wiki.kernel.org/index.php/Main_Page, https://github.com/lucvoo/sparse
or https://github.com/lucvoo/sparse-dev?

Thanks,

Bart.








[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux