All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: Andreas Sommer <AndiDog@web.de>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: libxc: Question on kernel image unzipping
Date: Thu, 09 Jul 2009 16:03:43 +0200	[thread overview]
Message-ID: <4A55F8BF.9030101@redhat.com> (raw)
In-Reply-To: <C67BB4E8.F3DB%keir.fraser@eu.citrix.com>

On 07/09/09 15:53, Keir Fraser wrote:
> On 09/07/2009 13:34, "Andreas Sommer"<AndiDog@web.de>  wrote:
>
>> libxc contains the following function which is used when uncompressing zipped
>> kernel images:
>> size_t xc_dom_check_gzip(void *blob, size_t ziplen)
>> {
>>      ...
>>      return unziplen + 16;
>> }
>> The returned unziplen+16 is used for the size of the destination buffer given
>> to inflate. But it is then also written to the kernel_size attribute of the
>> xc_dom_image struct. Hence kernel_size does not contain the uncompressed
>> kernel size but that plus 16.
>> So why do you always add 16 bytes to the real uncompressed kernel size?? That
>> doesn't make much sense to me but I need to know it because it is related to
>> my current work.
>
> Gerd Hoffman would be the person to ask. The +16 doesn't appear to me to
> have any purpose.

Oh, has been quite a while.  IIRC that is related to zlib needing some 
extra space.  So I *think* you can drop it there to get a correct 
kernel_size, but then you'll have to care somewhere else (probably when 
allocating the unzip target buffer) about the 16 extra bytes to make 
sure zlib doesn't overrun the buffer.

But better double-check that ...

cheers,
   Gerd

      reply	other threads:[~2009-07-09 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 12:34 libxc: Question on kernel image unzipping Andreas Sommer
2009-07-09 13:53 ` Keir Fraser
2009-07-09 14:03   ` Gerd Hoffmann [this message]

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=4A55F8BF.9030101@redhat.com \
    --to=kraxel@redhat.com \
    --cc=AndiDog@web.de \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.