From 54dc6ad8d842e419cb51ce76ceb8f90f796d5b7e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 23 Jun 2010 11:41:21 +1000 Subject: [PATCH] walk_index: fix "found end of addresses" detection. As phys was being overloaded slightly, this was broken. Signed-off-by: NeilBrown --- modify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modify.c b/modify.c index 34712b8..d871d39 100644 --- a/modify.c +++ b/modify.c @@ -729,10 +729,11 @@ static u32 walk_index(u32 addr, char **bufp, int len, struct block *uninc, * Entries are 10 bytes: 6 byte dev address, 4 byte file address. */ char *buf = *bufp; + int found_end = 0; handle(data, addr, 0); /* initialise */ - while (len >= 10 || uninc != NULL) { + while ((len >= 10 && !found_end) || uninc != NULL) { unsigned long addr = 0; u64 phys = 0; @@ -740,6 +741,8 @@ static u32 walk_index(u32 addr, char **bufp, int len, struct block *uninc, phys = decode48(buf); addr = decode32(buf); len -= 10; + if (phys == 0) + found_end = 1; } while (uninc && @@ -762,8 +765,6 @@ static u32 walk_index(u32 addr, char **bufp, int len, struct block *uninc, *bufp = buf - 10; return 0; } - if (phys == 0 && uninc == NULL) - break; } handle(data, 0, ~(u64)0); /* finalise */ return 1; -- 2.39.5