Re: [PATCH] locking/atomics: don't alias ____ptr
From: Thomas Gleixner
Date: Wed Jun 28 2017 - 08:25:49 EST
On Wed, 28 Jun 2017, Dmitry Vyukov wrote:
> On Wed, Jun 28, 2017 at 1:10 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > #define cmpxchg_local(ptr, old, new) \
> > ({ \
> > - __typeof__(ptr) ____ptr = (ptr); \
> > - kasan_check_write(____ptr, sizeof(*____ptr)); \
> > - arch_cmpxchg_local(____ptr, (old), (new)); \
> > + kasan_check_write((ptr), sizeof(*(ptr))); \
> > + arch_cmpxchg_local((ptr), (old), (new)); \
>
>
> /\/\/\/\/\/\/\/\/\/\/\/\
>
> These are macros.
> If ptr is foo(), then we will call foo() twice.
If that's true, the foo() will be evaluated a gazillion more times down the
way to the end of this macro maze.
Thanks,
tglx