diff mbox series

trace-cmd library: Fix chunk_cmp()

Message ID 20220608104806.27edb40b@gandalf.local.home (mailing list archive)
State Accepted
Commit 2e794e4f8d5ede7f83391cd80b1e9843d4f62c5c
Headers show
Series trace-cmd library: Fix chunk_cmp() | expand

Commit Message

Steven Rostedt June 8, 2022, 2:48 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The binary search looking for an address in the compressed chunks was
failing when it should have found a chunk. The reason is that the order of
the offsets is in ascending order, but the search was looking as if it was
in descending order.

Fixes: 6a724f21bbbe1 ("trace-cmd library: Add logic for in-memory decompression")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/trace-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index e2ceff331869..fea991ce732c 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1285,7 +1285,7 @@  static int chunk_cmp(const void *A, const void *B)
 	if (CHUNK_CHECK_OFFSET(b, a->offset))
 		return 0;
 
-	if (b->offset < a->offset)
+	if (a->offset < b->offset)
 		return -1;
 
 	return 1;