Re: [PATCH] mm/memory.c: remove warning from an uninitializedspinlock. was: Re: 2.6.21-rc7-mm2

From: Andrew Morton
Date: Sun Apr 29 2007 - 04:21:26 EST


On Sun, 29 Apr 2007 08:50:49 +0200 Borislav Petkov <bbpetkov@xxxxxxxx> wrote:

>
> Introduce a macro for suppressing gcc from generating a warning about a probable
> unitialized state of a variable.
>
> Signed-off-by: Borislav Petkov <bbpetkov@xxxxxxxx>
>
> ---
>
> Index: linux-mm/include/linux/compiler.h
> ===================================================================
> --- linux-mm.orig/include/linux/compiler.h
> +++ linux-mm/include/linux/compiler.h
> @@ -109,6 +109,10 @@ extern int do_check_likely(struct likeli
> (typeof(ptr)) (__ptr + (off)); })
> #endif
>
> +#ifndef unitialized_var
> +# define unitialized_var(x) x = x
> +#endif
> +
> #endif /* __KERNEL__ */
>
> #endif /* __ASSEMBLY__ */
> Index: linux-mm/mm/memory.c
> ===================================================================
> --- linux-mm.orig/mm/memory.c
> +++ linux-mm/mm/memory.c
> @@ -1488,7 +1488,7 @@ static int apply_to_pte_range(struct mm_
> pte_t *pte;
> int err;
> struct page *pmd_page;
> - spinlock_t *ptl;
> + spinlock_t *unitialized_var(ptl);
>
> pte = (mm == &init_mm) ?
> pte_alloc_kernel(pmd, addr) :

Ho hum. I guess I'll slide this over to Linus if there's not too much
howling, and unless someone can come up with anything better.

I will, however, fix the spelling to "uninitialized" ;)

-
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/