[PATCH v2] kexec-tools: Don't duplicate the bzImage header area
Simon Horman
horms at verge.net.au
Wed Feb 9 18:25:32 EST 2011
On Wed, Feb 09, 2011 at 01:13:04PM +0200, Ahmed S. Darwish wrote:
> On Wed, Feb 09, 2011 at 07:15:45AM +0900, Simon Horman wrote:
> > On Tue, Feb 08, 2011 at 05:20:36PM +0200, Ahmed S. Darwish wrote:
> > >
> > > diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
> > > index 83d3a69..2312eb8 100644
> > > --- a/kexec/arch/i386/kexec-bzImage.c
> > > +++ b/kexec/arch/i386/kexec-bzImage.c
> > > @@ -43,32 +43,32 @@ static const int probe_debug = 0;
> > >
> > > int bzImage_probe(const char *buf, off_t len)
> > > {
> > > - struct x86_linux_header header;
> > > + const struct x86_linux_header *header;
> > > if ((uintmax_t)len < (uintmax_t)sizeof(header)) {
> > > return -1;
> > > }
> > > - memcpy(&header, buf, sizeof(header));
> > > - if (memcmp(header.header_magic, "HdrS", 4) != 0) {
> > > + header = (void *)buf;
> >
> > Perhaps casting to (struct x86_linux_header*) would read better?
> >
>
> I felt that '(const struct x86_linux_header *)' is a bit long, but it's
> not a big deal. Attached is the same patch with that line modified:
>
> ==>
>
> Don't wholeheartedly copy the 32-Kbytes bzImage header area to the stack,
> just use a constant pointer instead.
Thanks, applied.
More information about the kexec
mailing list