diff options
-rw-r--r-- | lib/vsprintf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 5391299c1e78..b8fbd275bc46 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -870,13 +870,15 @@ static noinline_for_stack | |||
870 | char *pointer(const char *fmt, char *buf, char *end, void *ptr, | 870 | char *pointer(const char *fmt, char *buf, char *end, void *ptr, |
871 | struct printf_spec spec) | 871 | struct printf_spec spec) |
872 | { | 872 | { |
873 | int default_width = 2 * sizeof(void *) + (spec.flags & SPECIAL ? 2 : 0); | ||
874 | |||
873 | if (!ptr && *fmt != 'K') { | 875 | if (!ptr && *fmt != 'K') { |
874 | /* | 876 | /* |
875 | * Print (null) with the same width as a pointer so it makes | 877 | * Print (null) with the same width as a pointer so it makes |
876 | * tabular output look nice. | 878 | * tabular output look nice. |
877 | */ | 879 | */ |
878 | if (spec.field_width == -1) | 880 | if (spec.field_width == -1) |
879 | spec.field_width = 2 * sizeof(void *); | 881 | spec.field_width = default_width; |
880 | return string(buf, end, "(null)", spec); | 882 | return string(buf, end, "(null)", spec); |
881 | } | 883 | } |
882 | 884 | ||
@@ -931,7 +933,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
931 | */ | 933 | */ |
932 | if (in_irq() || in_serving_softirq() || in_nmi()) { | 934 | if (in_irq() || in_serving_softirq() || in_nmi()) { |
933 | if (spec.field_width == -1) | 935 | if (spec.field_width == -1) |
934 | spec.field_width = 2 * sizeof(void *); | 936 | spec.field_width = default_width; |
935 | return string(buf, end, "pK-error", spec); | 937 | return string(buf, end, "pK-error", spec); |
936 | } | 938 | } |
937 | if (!((kptr_restrict == 0) || | 939 | if (!((kptr_restrict == 0) || |
@@ -948,7 +950,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
948 | } | 950 | } |
949 | spec.flags |= SMALL; | 951 | spec.flags |= SMALL; |
950 | if (spec.field_width == -1) { | 952 | if (spec.field_width == -1) { |
951 | spec.field_width = 2 * sizeof(void *); | 953 | spec.field_width = default_width; |
952 | spec.flags |= ZEROPAD; | 954 | spec.flags |= ZEROPAD; |
953 | } | 955 | } |
954 | spec.base = 16; | 956 | spec.base = 16; |