From 73459797fdba710990d835cd018058e5e8c3a52f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 11 Apr 2017 07:58:08 +0200 Subject: [PATCH] BUILD/MINOR: tools: fix build warning in debug_hexdump() Commit 0ebb511 ("MINOR: tools: add a generic hexdump function for debugging") introduced debug_hexdump() which is used to dump a memory area during debugging sessions. This function can start at an unaligned offset and uses a signed comparison to know where to start dumping from. But the operation mixes signed and unsigned, making the test incorrect and causing the following warnings to be emitted under Clang : src/standard.c:3775:14: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if (b + j >= 0 && b + j < len) ~~~~~ ^ ~ Make "j" signed instead. At the moment this function is not used at all so there's no impact. Thanks to Dmitry Sivachenko for reporting it. No backport is needed. --- src/standard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/standard.c b/src/standard.c index 5dcf994..99f7066 100644 --- a/src/standard.c +++ b/src/standard.c @@ -3765,8 +3765,8 @@ int dump_text_line(struct chunk *out, const char *buf, int bsize, int len, */ void debug_hexdump(FILE *out, char *buf, unsigned int baseaddr, int len) { - unsigned int i, j; - int b; + unsigned int i; + int b, j; for (i = 0; i < (len + (baseaddr & 15)); i += 16) { b = i - (baseaddr & 15); -- 1.7.10.4