public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path
Date: Wed, 30 Jan 2013 13:34:43 -0800	[thread overview]
Message-ID: <510991F3.9020006@zytor.com> (raw)
In-Reply-To: <1359581120-24397-4-git-send-email-yinghai@kernel.org>

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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2013-01-30 21:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 21:25 [PATCH v8 0/7] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 1/7] kexec, x86: set booloader id in setup_header Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 2/7] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path Yinghai Lu
2013-01-30 21:34   ` H. Peter Anvin [this message]
2013-01-30 22:09     ` Yinghai Lu
2013-01-30 22:11       ` H. Peter Anvin
2013-01-30 21:25 ` [PATCH v8 4/7] kexec, x86: Fix bzImage real-mode booting Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 5/7] kexec, x86: put ramdisk/cmd_line above 4G for 64bit bzImage Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 6/7] kexec, x86_64: Load bzImage64 above 4G Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 7/7] kexec, x86: handle Crash low kernel range Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=510991F3.9020006@zytor.com \
    --to=hpa@zytor.com \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=vgoyal@redhat.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox