lkml.org 
[lkml]   [2019]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 05/17] add support for Clang's Shadow Call Stack (SCS)
On Fri, Oct 25, 2019 at 9:22 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
> > +static void scs_free(void *s)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < SCS_CACHE_SIZE; i++) {
> > + if (this_cpu_cmpxchg(scs_cache[i], 0, s) != 0)
> > + continue;
> > +
> > + return;
> > + }
>
> prefer:
>
> for ...:
> if foo() == 0:
> return
>
> to:
>
> for ...:
> if foo() != 0:
> continue
> return

This was essentially copied from free_thread_stack in kernel/fork.c,
but I agree, your way is cleaner. I'll change this in the next
version. Thanks!

Sami

\
 
 \ /
  Last update: 2019-10-25 22:52    [W:0.221 / U:25.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site