public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com,
	ebiederm@xmission.com, vgoyal@redhat.com, mjg@redhat.com,
	arozansk@redhat.com,
	Phillip Lougher <phillip@lougher.demon.co.uk>
Subject: Re: [PATCH]: Fix checkstack warning in bunzip2 library
Date: Wed, 26 May 2010 16:55:11 -0700	[thread overview]
Message-ID: <20100526165511.b2c1198e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100525223406.9446.46193.sendpatchset@prarit.bos.redhat.com>

On Tue, 25 May 2010 18:37:48 -0400
Prarit Bhargava <prarit@redhat.com> wrote:

> Fix checkstack error:
> 
> lib/decompress_bunzip2.c: In function ___get_next_block___:
> lib/decompress_bunzip2.c:511: warning: the frame size of 1932 bytes is larger than 1024 bytes
> 
> byteCount, symToByte, and mtfSymbol cannot be declared static or allocated
> dynamically so place them in the bunzip_data struct.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> 
> diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
> index a4e971d..81c8bb1 100644
> --- a/lib/decompress_bunzip2.c
> +++ b/lib/decompress_bunzip2.c
> @@ -107,6 +107,8 @@ struct bunzip_data {
>  	unsigned char selectors[32768];		/* nSelectors = 15 bits */
>  	struct group_data groups[MAX_GROUPS];	/* Huffman coding tables */
>  	int io_error;			/* non-zero if we have IO error */
> +	int byteCount[256];
> +	unsigned char symToByte[256], mtfSymbol[256];
>  };
>  
>  
> @@ -158,14 +160,16 @@ static int INIT get_next_block(struct bunzip_data *bd)
>  	int *base = NULL;
>  	int *limit = NULL;
>  	int dbufCount, nextSym, dbufSize, groupCount, selector,
> -		i, j, k, t, runPos, symCount, symTotal, nSelectors,
> -		byteCount[256];
> -	unsigned char uc, symToByte[256], mtfSymbol[256], *selectors;
> +		i, j, k, t, runPos, symCount, symTotal, nSelectors, *byteCount;
> +	unsigned char uc, *symToByte, *mtfSymbol, *selectors;
>  	unsigned int *dbuf, origPtr;
>  
>  	dbuf = bd->dbuf;
>  	dbufSize = bd->dbufSize;
>  	selectors = bd->selectors;
> +	byteCount = bd->byteCount;
> +	symToByte = bd->symToByte;
> +	mtfSymbol = bd->mtfSymbol;
>  
>  	/* Read in header signature and CRC, then validate signature.
>  	   (last block signature means CRC is for whole file, return now) */

hm, I'm not sure that checkstack warnings are very relevant in the
contexts where this code executes, but the change is clean enough and
squishing a warning is good.

  reply	other threads:[~2010-05-26 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 22:37 [PATCH]: Fix checkstack warning in bunzip2 library Prarit Bhargava
2010-05-26 23:55 ` Andrew Morton [this message]
2010-05-26 23:58   ` 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=20100526165511.b2c1198e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arozansk@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=phillip@lougher.demon.co.uk \
    --cc=prarit@redhat.com \
    --cc=vgoyal@redhat.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