From: Li Nan <linan122@xxxxxxxxxx> The offset of 'lo' must <= ‘s' after biset. clean up redundant check. And replace the check of badblocks->count with badblocks_empty(). Signed-off-by: Li Nan <linan122@xxxxxxxxxx> --- block/badblocks.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/badblocks.c b/block/badblocks.c index 71a3e43351da..88ed13897443 100644 --- a/block/badblocks.c +++ b/block/badblocks.c @@ -486,7 +486,7 @@ static int prev_badblocks(struct badblocks *bb, struct badblocks_context *bad, int lo, hi; u64 *p; - if (!bb->count) + if (badblocks_empty(bb)) goto out; if (hint >= 0) { @@ -521,8 +521,7 @@ static int prev_badblocks(struct badblocks *bb, struct badblocks_context *bad, hi = mid; } - if (BB_OFFSET(p[lo]) <= s) - ret = lo; + ret = lo; out: return ret; } -- 2.39.2