Re: [PATCH] m68k: don't alias VMALLOC_END to vmalloc_end

From: Geert Uytterhoeven
Date: Tue Dec 08 2009 - 04:08:16 EST


On Tue, Dec 8, 2009 at 07:57, Tejun Heo <teheo@xxxxxxxxxx> wrote:
> On SUN3, m68k defines macro VMALLOC_END as unsigned long variable
> vmalloc_end which is adjusted from mmu_emu_init(). ÂThis becomes
> problematic if a local variables vmalloc_end is defined in some
> function (not very unlikely) and VMALLOC_END is used in the function -
> the function thinks its referencing the global VMALLOC_END value but
> would be referencing its own local vmalloc_end variable.
>
> There's no reason VMALLOC_END should be a macro. ÂJust define it as an
> unsigned long variable to avoid nasty surprises.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Cc: Roman Zippel <zippel@xxxxxxxxxxxxxx>
> ---
> Okay, here it is. ÂCompile tested. ÂGeert, Roman, if you guys don't
> object, I'd like to push it with the rest of percpu changes to Linus.
> What do you think?

Fine for me, except that by convention allcaps is reserved for macros?

>
> Thanks.
>
> Âarch/m68k/include/asm/pgtable_mm.h | Â Â3 +--
> Âarch/m68k/sun3/mmu_emu.c      |  Â8 ++++----
> Â2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
> index fe60e1a..0ea9f09 100644
> --- a/arch/m68k/include/asm/pgtable_mm.h
> +++ b/arch/m68k/include/asm/pgtable_mm.h
> @@ -83,9 +83,8 @@
> Â#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
> Â#define VMALLOC_END KMAP_START
> Â#else
> -extern unsigned long vmalloc_end;
> Â#define VMALLOC_START 0x0f800000
> -#define VMALLOC_END vmalloc_end
> +extern unsigned long VMALLOC_END;
> Â#endif /* CONFIG_SUN3 */
>
> Â/* zero page used for uninitialized stuff */
> diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
> index 3cd1939..25e2b14 100644
> --- a/arch/m68k/sun3/mmu_emu.c
> +++ b/arch/m68k/sun3/mmu_emu.c
> @@ -45,8 +45,8 @@
> Â** Globals
> Â*/
>
> -unsigned long vmalloc_end;
> -EXPORT_SYMBOL(vmalloc_end);
> +unsigned long VMALLOC_END;
> +EXPORT_SYMBOL(VMALLOC_END);
>
> Âunsigned long pmeg_vaddr[PMEGS_NUM];
> Âunsigned char pmeg_alloc[PMEGS_NUM];
> @@ -172,8 +172,8 @@ void mmu_emu_init(unsigned long bootmem_end)
> Â#endif
> Â Â Â Â Â Â Â Â Â Â Â Â// the lowest mapping here is the end of our
> Â Â Â Â Â Â Â Â Â Â Â Â// vmalloc region
> - Â Â Â Â Â Â Â Â Â Â Â if(!vmalloc_end)
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â vmalloc_end = seg;
> + Â Â Â Â Â Â Â Â Â Â Â if (!VMALLOC_END)
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â VMALLOC_END = seg;
>
> Â Â Â Â Â Â Â Â Â Â Â Â// mark the segmap alloc'd, and reserve any
> Â Â Â Â Â Â Â Â Â Â Â Â// of the first 0xbff pages the hardware is
>



--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/