diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2019-02-21 16:58:01 +1030 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-02-21 22:58:46 -0600 |
commit | 3852a9460abcb6f38f2c0af97d17b168ee1629f1 (patch) | |
tree | 943289eb73a51719be58f10e473f26f9d04f90ed /external | |
parent | 0dec1de73e1e11e94a15b07a1563941ab18f2ab0 (diff) | |
download | skiboot-3852a9460abcb6f38f2c0af97d17b168ee1629f1.zip skiboot-3852a9460abcb6f38f2c0af97d17b168ee1629f1.tar.gz skiboot-3852a9460abcb6f38f2c0af97d17b168ee1629f1.tar.bz2 |
ffspart, libflash: Fix stack size warnings
libflash/file.c: In function 'file_erase':
libflash/file.c:134:1: error: the frame size of 4128 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
}
^
and
ffspart.c: In function ‘main’:
ffspart.c:529:1: error: the frame size of 4864 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
}
^
In both cases, mark the local variables as static to avoid the stack.
The static approach is valid for file.c as the buffer is always filled
with `~0`. Given it's now going to be in .bss due to static we have to
still perform the memset(), but racing memset()s in this fashion won't
be harmful, just wasteful.
For ffspart.c's main(), there are bigger problems if that needs to be
re-entrant.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/ffspart/ffspart.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/external/ffspart/ffspart.c b/external/ffspart/ffspart.c index bb46a9e..9fc015c 100644 --- a/external/ffspart/ffspart.c +++ b/external/ffspart/ffspart.c @@ -350,7 +350,9 @@ static void print_help(const char *pname) int main(int argc, char *argv[]) { - char *pnor = NULL, *input = NULL, line[MAX_LINE]; + static char line[MAX_LINE]; + + char *pnor = NULL, *input = NULL; bool toc_created = false, bad_input = false, allow_empty = false; uint32_t block_size = 0, block_count = 0; struct ffs_hdr *tocs[MAX_TOCS] = { 0 }; |