Re: [PATCH] x86: add boundary check for 32bit res before expande820 resource to alignment -v2

From: Ingo Molnar
Date: Fri Jul 03 2009 - 04:06:48 EST



* Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> +#define MAX_RESOURCE_SIZE ((resource_size_t)-1)

> + end = round_up(start, ram_alignment(start)) - 1;
> + if (end > MAX_RESOURCE_SIZE)
> + end = MAX_RESOURCE_SIZE;

As Andrew noted it, this should probably have a comment along the
lines of:

/*
* Clip entries that go beyond our maximum resource
* awareness limit to the max. If we accepted them
* blindly we'd get random rounding artifacts and a
* possibly messed up resource tree and boot
* failures:
*/
if (end > MAX_RESOURCE_SIZE)
end = MAX_RESOURCE_SIZE;

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