Re: [PATCH 23/35] x86: make 32bit support NO_BOOTMEM

From: Andrew Morton
Date: Tue Feb 09 2010 - 15:04:26 EST


On Tue, 09 Feb 2010 11:32:34 -0800
Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> --- a/arch/x86/kernel/early_res.c
> +++ b/arch/x86/kernel/early_res.c
> @@ -354,6 +354,9 @@ int __init get_free_all_memory_range(struct range **rangep, int nodeid)
>
> /* need to go over early_node_map to find out good range for node */
> nr_range = add_from_early_node_map(range, count, nr_range, nodeid);
> +#ifdef CONFIG_X86_32
> + subtract_range(range, count, max_low_pfn, -1UL);
> +#endif
> subtract_early_res(range, count);
> nr_range = clean_sort_range(range, count);

I'm too lazy to hunt through all the patches to see the surrounding code...

The "-1UL" is worrisome. If that contant is to be assigned to a u64
then on x86_32 we end up with 0x00000000ffffffff, which is surely
wrong.

Generally I think it's safer and more maintainable (but odd-looking) to
use plain old "-1" when specifying the all-ones contant pattern.
Because "-1" always works, whatever the size of the target scalar.
This particularly matters when you're dealing with types which have
different sizes on different architectures, or whose type changes with
config options.


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