Subject: Re: WARN_ON() is buggy for 32 bit systems

From: Dan Carpenter <[email-masked]>
Date: Thu, 27 Jan 2022 16:37:07 +0300

On Thu, Jan 27, 2022 at 10:10:32PM +1100, Michael Ellerman wrote:
> Dan Carpenter <[email-masked]> writes:
> > On Wed, Jan 26, 2022 at 12:21:49PM +0000, Christophe Leroy wrote:
> >> The code is enclosed in a #ifdef CONFIG_PPC64, it is not used for PPC32:
> >> 
> >> /arch/powerpc/include/asm/bug.h
> >>    99  #ifdef CONFIG_PPC64
> >
> > Ah...
> >
> > You know, life would be a lot easier for me personally if we added an
> > #ifndef __CHECKER__ as well...  I can't compile PowerPC code so I can't
> > test a patch like that.
> 
> Ubuntu & Fedora both have cross compilers packaged, or there's cross
> compilers on kernel.org. But I assume you mean you'd rather not bother
> compiling for powerpc, which is fair enough.
> 
> Do you mean something like below?

Yes, please.

> 
> I'm not sure about that, as it would prevent sparse from checking the
> actual BUG_ON code we're using, vs the generic version which we never
> use on 64-bit. Is there a smatch specific macro we could check?

There isn't a Smatch define.  This shouldn't affect Sparse at all unless
there was a bug in the WARN_ON() macro.

regards,
dan carpenter