Skip to contentSkip to conversation

trace-cmd library: Fix chunk_cmp()

PATCH New Steven Rostedt 1 participant 1 message Jun 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd library: Fix chunk_cmp()

From: "Steven Rostedt (Google)" <[email protected]>

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")
---
 lib/trace-cmd/trace-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-input.c +1 -1
index e2ceff331869..fea991ce732c 100644
@@ -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;
Signature · 1 line
2.35.1