Re: [PATCH 3/3] futex: add futex_q static initializer
From: Thomas Gleixner
Date: Mon Nov 08 2010 - 11:42:50 EST
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@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> CC: Eric Dumazet <eric.dumazet@xxxxxxxxx>
> CC: John Kacur <jkacur@xxxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/