[PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path

H. Peter Anvin hpa at zytor.com
Wed Jan 30 16:34:43 EST 2013


On 01/30/2013 01:25 PM, Yinghai Lu wrote:
>  
> +static void clean_boot_params(unsigned char *real_mode, unsigned long size)
> +{
> +	unsigned long end;
> +
> +	/* clear value before header */
> +	memset(real_mode, 0, 0x1f1);
> +	/* clear value after setup_header  */
> +	end = *(real_mode + 0x201);

real_mode[0x201] might be clearer...

> +	end += 0x202;
> +	if (end < size)
> +		memset(real_mode + end, 0, size - end);
> +}

You don't actually need the test... the value is inherently smaller than
0x301 which is less than the size.

That being said, if you want to sanity-check it you can check that the
value is in a sensible range -- the permitted range is 0x22 to 0x7f
inclusive, corresponding to a total end value of 0x224 to 0x281.

	-hpa




More information about the kexec mailing list