1From b795c06d8a44f42cdffdf5aa9561ff8de20d78cc Mon Sep 17 00:00:00 2001 2From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com> 3Date: Mon, 7 Nov 2022 17:50:50 +0530 4Subject: libext2fs: fix ext2fs_compare_generic_bmap logic 5 6Currently this function was not correctly comparing against the right 7length of the bitmap. Also when we compare bitarray v/s rbtree bitmap 8the value returned by ext2fs_test_generic_bmap() could be different in 9these two implementations. Hence only check against boolean value. 10 11Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> 12Signed-off-by: Theodore Ts'o <tytso@mit.edu> 13--- 14 lib/ext2fs/gen_bitmap64.c | 10 +++++++--- 15 1 file changed, 7 insertions(+), 3 deletions(-) 16 17diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c 18index c860c10e..f7710afd 100644 19--- a/lib/ext2fs/gen_bitmap64.c 20+++ b/lib/ext2fs/gen_bitmap64.c 21@@ -629,10 +629,14 @@ errcode_t ext2fs_compare_generic_bmap(errcode_t neq, 22 (bm1->end != bm2->end)) 23 return neq; 24 25- for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++) 26- if (ext2fs_test_generic_bmap(gen_bm1, i) != 27- ext2fs_test_generic_bmap(gen_bm2, i)) 28+ for (i = bm1->start; i < bm1->end; i++) { 29+ int ret1, ret2; 30+ ret1 = !!ext2fs_test_generic_bmap(gen_bm1, i); 31+ ret2 = !!ext2fs_test_generic_bmap(gen_bm2, i); 32+ if (ret1 != ret2) { 33 return neq; 34+ } 35+ } 36 37 return 0; 38 } 39-- 40cgit 41 42