aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>2012-12-17 18:59:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:13 -0500
commitef12496022d5917cfe0b04cf8fd685fc6bc08400 (patch)
tree0dde49b464f3d06f1279c6262e2b3d9800893e1d /lib
parent2fa72c8fa5d03c4e07894ccb9f0be72e8687a455 (diff)
lib/vsprintf.c: fix handling of %zd when using ssize_t
Documentation/printk-formats.txt says to use %zd for a ssize_t argument and some drivers do. Unfortunately this prints a positive number for negative values eg: tpm_tis 70030000.tpm_tis: tpm_transmit: tpm_send: error 4294967234 Add a case to va_args a ssize_t type if the interpretation should be signed. Tested on PPC32. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 39c99fea7c03..41da0741a663 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1485,7 +1485,10 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
1485 num = va_arg(args, long); 1485 num = va_arg(args, long);
1486 break; 1486 break;
1487 case FORMAT_TYPE_SIZE_T: 1487 case FORMAT_TYPE_SIZE_T:
1488 num = va_arg(args, size_t); 1488 if (spec.flags & SIGN)
1489 num = va_arg(args, ssize_t);
1490 else
1491 num = va_arg(args, size_t);
1489 break; 1492 break;
1490 case FORMAT_TYPE_PTRDIFF: 1493 case FORMAT_TYPE_PTRDIFF:
1491 num = va_arg(args, ptrdiff_t); 1494 num = va_arg(args, ptrdiff_t);