lkml.org 
[lkml]   [2010]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/3] futex: add futex_q static initializer
    On Wed, 27 Oct 2010, Darren Hart wrote:

    > The futex_q struct has grown considerably over the last couple years. I
    > believe it now merits a static initializer to avoid uninitialized data
    > errors (having spent more time than I care to admit debugging an uninitialized
    > q.bitset in an experimental new op code).
    >
    > With the key initializer built in, several of the FUTEX_KEY_INIT calls can
    > be removed.
    >
    > Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
    > Cc: Thomas Gleixner <tglx@linutronix.de>
    > Cc: Peter Zijlstra <peterz@infradead.org>
    > Cc: Ingo Molnar <mingo@elte.hu>
    > CC: Eric Dumazet <eric.dumazet@gmail.com>
    > CC: John Kacur <jkacur@redhat.com>
    > ---
    > kernel/futex.c | 25 ++++++++++---------------
    > 1 files changed, 10 insertions(+), 15 deletions(-)
    >
    > diff --git a/kernel/futex.c b/kernel/futex.c
    > index 8502498..4a10d44 100644
    > --- a/kernel/futex.c
    > +++ b/kernel/futex.c
    > @@ -131,6 +131,12 @@ struct futex_q {
    > u32 bitset;
    > };
    >
    > +#define FUTEX_Q_INIT \
    > + { /* list gets initialized in queue_me()*/ \
    > + .task = NULL, NULL, FUTEX_KEY_INIT \
    > + , NULL, NULL, NULL, FUTEX_BITSET_MATCH_ANY }
    > +

    That should be a static readonly variable with a proper C99
    initializer.

    Thanks,

    tglx


    \
     
     \ /
      Last update: 2010-11-08 17:45    [W:0.042 / U:58.744 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site