parisc: update parisc for new irq_desc
[safe/jmp/linux-2.6] / lib / vsprintf.c
index dd7cc7f..0fbd012 100644 (file)
@@ -170,6 +170,8 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
                return -EINVAL;
 
        val = simple_strtoul(cp, &tail, base);
+       if (tail == cp)
+               return -EINVAL;
        if ((*tail == '\0') ||
                ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
                *res = val;
@@ -241,6 +243,8 @@ int strict_strtoull(const char *cp, unsigned int base, unsigned long long *res)
                return -EINVAL;
 
        val = simple_strtoull(cp, &tail, base);
+       if (tail == cp)
+               return -EINVAL;
        if ((*tail == '\0') ||
                ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
                *res = val;
@@ -620,11 +624,15 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
                         int precision, int flags)
 {
        char ip4_addr[4 * 4]; /* (4 * 3 decimal digits), 3 dots and trailing zero */
+       char temp[3];   /* hold each IP quad in reverse order */
        char *p = ip4_addr;
-       int i;
+       int i, digits;
 
        for (i = 0; i < 4; i++) {
-               p = put_dec_trunc(p, addr[i]);
+               digits = put_dec_trunc(temp, addr[i]) - temp;
+               /* reverse the digits in the quad */
+               while (digits--)
+                       *p++ = temp[digits];
                if (i != 3)
                        *p++ = '.';
        }
@@ -657,6 +665,9 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
  */
 static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags)
 {
+       if (!ptr)
+               return string(buf, end, "(null)", field_width, precision, flags);
+
        switch (*fmt) {
        case 'F':
                ptr = dereference_function_descriptor(ptr);
@@ -665,6 +676,9 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
                return symbol_string(buf, end, ptr, field_width, precision, flags);
        case 'R':
                return resource_string(buf, end, ptr, field_width, precision, flags);
+       case 'm':
+               flags |= SPECIAL;
+               /* Fallthrough */
        case 'M':
                return mac_address_string(buf, end, ptr, field_width, precision, flags);
        case 'i':