ARM: Fix valgrind reported error on O3 that was causing minor stats changes.
authorAli Saidi <Ali.Saidi@ARM.com>
Fri, 9 Mar 2012 14:59:26 +0000 (09:59 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Fri, 9 Mar 2012 14:59:26 +0000 (09:59 -0500)
src/arch/arm/linux/atag.hh

index b7c37dffdc0b2a1bef31b424527a4996ca955a8a..71271dac29a9501722afed239c212f940c53fadb 100644 (file)
@@ -156,7 +156,10 @@ class AtagCmdline : public AtagHeader
 
         delete[] storage;
         storage = new uint32_t[size()];
-
+        // Initialize the last byte of memory here beacuse it might be slightly
+        // longer than needed and mis-speculation of the NULL in the O3 CPU can
+        // change stats ever so slightly when that happens.
+        storage[size() - 1] = 0;
         strcpy((char*)&storage[2] , s.c_str());
     }
     AtagCmdline()