]> www.infradead.org Git - users/willy/linux.git/commitdiff
printf: Convert restricted_pointer to printf_state
authorMatthew Wilcox <willy@infradead.org>
Wed, 19 Dec 2018 15:35:24 +0000 (10:35 -0500)
committerMatthew Wilcox <willy@infradead.org>
Wed, 19 Dec 2018 15:35:24 +0000 (10:35 -0500)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/vsprintf.c

index bce6174074c20b3c0dc1e1e380a55512726bbde1..b7cef6812819e454647562157ab3d5b527bd9348 100644 (file)
@@ -1471,8 +1471,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 int kptr_restrict __read_mostly;
 
 static noinline_for_stack
-char *restricted_pointer(char *buf, char *end, const void *ptr,
-                        struct printf_spec spec)
+char *restricted_pointer(struct printf_state *ps, const void *ptr)
 {
        switch (kptr_restrict) {
        case 0:
@@ -1486,9 +1485,10 @@ char *restricted_pointer(char *buf, char *end, const void *ptr,
                 * because its test for CAP_SYSLOG would be meaningless.
                 */
                if (in_irq() || in_serving_softirq() || in_nmi()) {
-                       if (spec.field_width == -1)
-                               spec.field_width = 2 * sizeof(ptr);
-                       return string(buf, end, "pK-error", spec);
+                       if (ps->spec.field_width == -1)
+                               ps->spec.field_width = 2 * sizeof(ptr);
+                       printf_string(ps, "pK-error");
+                       return ps->buf;
                }
 
                /*
@@ -1514,7 +1514,7 @@ char *restricted_pointer(char *buf, char *end, const void *ptr,
                break;
        }
 
-       return pointer_string(buf, end, ptr, spec);
+       return pointer_string(ps->buf, ps->end, ptr, ps->spec);
 }
 
 static noinline_for_stack
@@ -1958,7 +1958,7 @@ char *pointer(struct printf_state *ps, void *ptr)
        case 'K':
                if (!kptr_restrict)
                        break;
-               return restricted_pointer(buf, end, ptr, spec);
+               return restricted_pointer(ps, ptr);
        case 'N':
                return netdev_bits(ps, ptr);
        case 'a':