From: Matt Mackall <mpm@selenic.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] deflate inflate_dynamic too
Date: Sat, 28 Apr 2007 11:22:52 -0500 [thread overview]
Message-ID: <20070428162252.GZ11115@waste.org> (raw)
In-Reply-To: <4632AF57.1070102@goop.org>
On Fri, Apr 27, 2007 at 07:20:07PM -0700, Jeremy Fitzhardinge wrote:
> inflate_dynamic() has piggy stack usage too, so heap allocate it too.
> I'm not sure it actually gets used, but it shows up large in "make
> checkstack".
Might as well drop the PKZIP bit while we're at it. No one's ever
built a zimage with PKZIP.
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
>
> ---
> lib/inflate.c | 63 ++++++++++++++++++++++++++++++++++++++-------------------
> 1 file changed, 42 insertions(+), 21 deletions(-)
>
> ===================================================================
> --- a/lib/inflate.c
> +++ b/lib/inflate.c
> @@ -798,15 +798,18 @@ STATIC int noinline INIT inflate_dynamic
> unsigned nb; /* number of bit length codes */
> unsigned nl; /* number of literal/length codes */
> unsigned nd; /* number of distance codes */
> -#ifdef PKZIP_BUG_WORKAROUND
> - unsigned ll[288+32]; /* literal/length and distance code lengths */
> -#else
> - unsigned ll[286+30]; /* literal/length and distance code lengths */
> -#endif
> + unsigned *ll; /* literal/length and distance code lengths */
> register ulg b; /* bit buffer */
> register unsigned k; /* number of bits in bit buffer */
> + int ret;
>
> DEBG("<dyn");
> +
> +#ifdef PKZIP_BUG_WORKAROUND
> + ll = malloc(sizeof(*ll) * (288+32)); /* literal/length and distance code lengths */
> +#else
> + ll = malloc(sizeof(*ll) * (286+30)); /* literal/length and distance code lengths */
> +#endif
>
> /* make local bit buffer */
> b = bb;
> @@ -828,7 +831,10 @@ DEBG("<dyn");
> #else
> if (nl > 286 || nd > 30)
> #endif
> - return 1; /* bad lengths */
> + {
> + ret = 1; /* bad lengths */
> + goto out;
> + }
>
> DEBG("dyn1 ");
>
> @@ -850,7 +856,8 @@ DEBG("dyn2 ");
> {
> if (i == 1)
> huft_free(tl);
> - return i; /* incomplete code set */
> + ret = i; /* incomplete code set */
> + goto out;
> }
>
> DEBG("dyn3 ");
> @@ -872,8 +879,10 @@ DEBG("dyn3 ");
> NEEDBITS(2)
> j = 3 + ((unsigned)b & 3);
> DUMPBITS(2)
> - if ((unsigned)i + j > n)
> - return 1;
> + if ((unsigned)i + j > n) {
> + ret = 1;
> + goto out;
Heh. Anti-tab damage.
--
Mathematics is the supreme nostalgia of our time.
next prev parent reply other threads:[~2007-04-28 16:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-28 2:20 [PATCH] deflate inflate_dynamic too Jeremy Fitzhardinge
2007-04-28 16:22 ` Matt Mackall [this message]
2007-05-07 18:34 ` H. Peter Anvin
2007-05-07 20:29 ` Jeremy Fitzhardinge
2007-05-07 20:53 ` H. Peter Anvin
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=20070428162252.GZ11115@waste.org \
--to=mpm@selenic.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.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