Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Dave Young <dyoung@redhat.com>
Cc: Wang Nan <wangnan0@huawei.com>,
	kexec@lists.infradead.org, Geng Hui <hui.geng@huawei.com>
Subject: Re: [PATCH 1/2] kexec: align initrd when no --image-size passed
Date: Thu, 20 Mar 2014 12:51:02 +0900	[thread overview]
Message-ID: <20140320035102.GD10601@verge.net.au> (raw)
In-Reply-To: <20140320032506.GA4722@dhcp-16-126.nay.redhat.com>

On Thu, Mar 20, 2014 at 11:25:07AM +0800, Dave Young wrote:
> On 03/20/14 at 10:36am, Wang Nan wrote:
> > Before this patch, when no --image-size passed, initrd_base is caculated using
> > base + len * 4, which is unaligned, and unable to pass check in
> > add_segment_phys_virt():
> > 
> > 	if (base & (pagesize -1)) {
> > 		die("Base address: 0x%lx is not page aligned\n", base);
> > 	}
> > 
> > This patch also uses getpagesize() instead of hard encoded 4096.
> > 
> > Signed-off-by: Wang Nan <wangnan0@huawei.com>
> > Cc: Simon Horman <horms@verge.net.au>
> > Cc: Dave Young <dyoung@redhat.com>
> > Cc: Geng Hui <hui.geng@huawei.com>
> > ---
> >  kexec/arch/arm/kexec-zImage-arm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
> > index 792187a..8a35018 100644
> > --- a/kexec/arch/arm/kexec-zImage-arm.c
> > +++ b/kexec/arch/arm/kexec-zImage-arm.c
> > @@ -347,11 +347,11 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
> >  		/* If the image size was passed as command line argument,
> >  		 * use that value for determining the address for initrd,
> >  		 * atags and dtb images. page-align the given length.*/
> > -		initrd_base = base + _ALIGN(kexec_arm_image_size, 4096);
> > +		initrd_base = base + _ALIGN(kexec_arm_image_size, getpagesize());
> >  	} else {
> >  		/* Otherwise, assume the maximum kernel compression ratio
> >  		 * is 4, and just to be safe, place ramdisk after that */
> > -		initrd_base = base + len * 4;
> > +		initrd_base = base + _ALIGN(len * 4, getpagesize());
> >  	}
> >  
> >  	if (use_atags) {
> > -- 
> > 1.8.4
> > 
> 
> Acked-by: Dave Young <dyoung@redhat.com>

Thanks, applied.

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

  reply	other threads:[~2014-03-20  3:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20  2:36 [PATCH 0/2] Two patches for kexec for arm Wang Nan
2014-03-20  2:36 ` [PATCH 1/2] kexec: align initrd when no --image-size passed Wang Nan
2014-03-20  3:25   ` Dave Young
2014-03-20  3:51     ` Simon Horman [this message]
2014-03-20  2:36 ` [PATCH 2/2] kexec: pass initrd position in dtb Wang Nan
2014-03-20  3:26   ` Dave Young
2014-03-20  3:34     ` Dave Young
2014-03-20  3:57       ` Wang Nan
2014-03-20  5:37         ` Dave Young
2014-03-20  5:41         ` Dave Young

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=20140320035102.GD10601@verge.net.au \
    --to=horms@verge.net.au \
    --cc=dyoung@redhat.com \
    --cc=hui.geng@huawei.com \
    --cc=kexec@lists.infradead.org \
    --cc=wangnan0@huawei.com \
    /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