* [PATCH]: Fix checkstack warning in bunzip2 library
@ 2010-05-25 22:37 Prarit Bhargava
2010-05-26 23:55 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Prarit Bhargava @ 2010-05-25 22:37 UTC (permalink / raw)
To: linux-kernel, hpa, ebiederm, vgoyal, mjg, arozansk; +Cc: Prarit Bhargava
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]
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) */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH]: Fix checkstack warning in bunzip2 library
2010-05-25 22:37 [PATCH]: Fix checkstack warning in bunzip2 library Prarit Bhargava
@ 2010-05-26 23:55 ` Andrew Morton
2010-05-26 23:58 ` H. Peter Anvin
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-05-26 23:55 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, hpa, ebiederm, vgoyal, mjg, arozansk,
Phillip Lougher
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]: Fix checkstack warning in bunzip2 library
2010-05-26 23:55 ` Andrew Morton
@ 2010-05-26 23:58 ` H. Peter Anvin
0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2010-05-26 23:58 UTC (permalink / raw)
To: Andrew Morton
Cc: Prarit Bhargava, linux-kernel, ebiederm, vgoyal, mjg, arozansk,
Phillip Lougher
On 05/26/2010 04:55 PM, Andrew Morton wrote:
> 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.
This code may be used by squashfs or btrfs, at least in the future, and
in those contexts it's highly relevant indeed.
-hpa
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-26 23:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 22:37 [PATCH]: Fix checkstack warning in bunzip2 library Prarit Bhargava
2010-05-26 23:55 ` Andrew Morton
2010-05-26 23:58 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox