hdt: Move ~162K byte data object from the stack to the bss
authorMatt Fleming <matt.fleming@intel.com>
Wed, 23 Jan 2013 13:24:36 +0000 (13:24 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Wed, 23 Jan 2013 15:05:28 +0000 (15:05 +0000)
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@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/hdt/hdt.c

index 653995d..67b3ab0 100644 (file)
@@ -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);