From 7ba63db908e5aef711e6b4261e00d1cef5a912e3 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sun, 1 Jan 2017 21:13:07 +0300 Subject: [PATCH] loop: fix printing of the reserved field array items They are of char type, so "hh" length modifier should be used (otherwise they are printed incorrectly as they are sign extended implicitly when passed as printf arguments in case char is a signed type which is true for most compilers). * loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx" in printing routine for array elements of the "reserved" field of loop_info structure. --- loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loop.c b/loop.c index 2ade8e7a..e43fcaad 100644 --- a/loop.c +++ b/loop.c @@ -82,7 +82,7 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr) if (!abbrev(tcp)) tprintf(", lo_init=[%#" PRI_klx ", %#" PRI_klx "]" - ", reserved=[%#x, %#x, %#x, %#x]}", + ", reserved=[%#hhx, %#hhx, %#hhx, %#hhx]}", (kernel_ulong_t) info.lo_init[0], (kernel_ulong_t) info.lo_init[1], info.reserved[0], info.reserved[1], -- 2.40.0