[13/13] btrfs-progs: check: fix false warning for check_extent_item()
diff mbox

Message ID 1469689705-26836-14-git-send-email-lufq.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Lu Fengqi July 28, 2016, 7:08 a.m. UTC
In the case that a extent doesn't have inline ref, this function
shouldn't report ITEM_SIZE_MISMATCH.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 cmds-check.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/cmds-check.c b/cmds-check.c
index c52eebc..9fe3643 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -10373,7 +10373,11 @@  static int check_extent_item(struct btrfs_fs_info *fs_info,
 	}
 	end = (unsigned long)ei + item_size;
 
-	if (ptr >= end) {
+	if (ptr == end) {
+		goto out;
+	} else if (ptr > end) {
+		error("bad extent item [%llu %u %llu] size wrong",
+		      key.objectid, key.type, key.offset);
 		err |= ITEM_SIZE_MISMATCH;
 		goto out;
 	}