common/vsprintf: fix signed->unsigned error, causing glacial performance
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Nov 2013 16:20:34 +0000 (17:20 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Nov 2013 16:20:34 +0000 (17:20 +0100)
The original patch for

  c/s 67a3542c5bc356e6452d8305991617c875f87de4
  "common/vsprintf: Refactor string() out of vsnprintf()"

specifically used signed integers, identical to the code copied out of vsprintf.

When committed, these had changed to unsigned integers, which causes a
functional change.  This causes glacial boot performance and an excessive
quantity of spaces printed to the serial console, as we loop to the upper
bound of a 32bit integer.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/vsprintf.c

index e8f45ebf6f906056bcbb5820d8ff47c418d36432..43dc3929163e787128577bb9e7d60c16effb594e 100644 (file)
@@ -239,7 +239,7 @@ static char *number(
 static char *string(char *str, char *end, const char *s,
                     int field_width, int precision, int flags)
 {
-    unsigned int i, len = strnlen(s, precision);
+    int i, len = strnlen(s, precision);
 
     if (!(flags & LEFT)) {
         while (len < field_width--) {