[syslinux:elflink] hdt: Move ~162K byte data object from the stack to the bss

syslinux-bot for Matt Fleming matt.fleming at intel.com
Wed Jan 23 07:09:11 PST 2013


Commit-ID:  b3dd49f09630ec1338d2ee987f794d49ca01c227
Gitweb:     http://www.syslinux.org/commit/b3dd49f09630ec1338d2ee987f794d49ca01c227
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 23 Jan 2013 13:24:36 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 23 Jan 2013 15:05:28 +0000

hdt: Move ~162K byte data object from the stack to the bss

A struct s_hardware is far too large to be placed onto the stack and
was causing us run past the end of the allocated stack and overwrite
the diskcache, which resulted in apparent file system corruption.

Move this hefty object into the bss.

Cc: Erwan Velu <erwanaliasr1 at gmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/hdt/hdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/com32/hdt/hdt.c b/com32/hdt/hdt.c
index 653995d..67b3ab0 100644
--- a/com32/hdt/hdt.c
+++ b/com32/hdt/hdt.c
@@ -48,7 +48,7 @@ int max_console_lines = MAX_CLI_LINES;
 int main(const int argc, const char *argv[])
 {
     char version_string[256];
-    struct s_hardware hardware;
+    static struct s_hardware hardware;
 
     snprintf(version_string, sizeof version_string, "%s %s (%s)",
 	     PRODUCT_NAME, VERSION, CODENAME);


More information about the Syslinux-commits mailing list