Commit 7d83c5d7 authored by Li Nan's avatar Li Nan Committed by Jens Axboe
Browse files

badblocks: Fix error shitf ops



'bb->shift' is used directly in badblocks. It is wrong, fix it.

Fixes: 3ea3354c ("badblocks: improve badblocks_check() for multiple ranges handling")
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Acked-by: default avatarColy Li <colyli@kernel.org>
Link: https://lore.kernel.org/r/20250227075507.151331-2-zhengqixing@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 85f72925
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -880,8 +880,8 @@ static int _badblocks_set(struct badblocks *bb, sector_t s, int sectors,
		/* round the start down, and the end up */
		sector_t next = s + sectors;

		rounddown(s, bb->shift);
		roundup(next, bb->shift);
		rounddown(s, 1 << bb->shift);
		roundup(next, 1 << bb->shift);
		sectors = next - s;
	}

@@ -1157,8 +1157,8 @@ static int _badblocks_clear(struct badblocks *bb, sector_t s, int sectors)
		 * isn't than to think a block is not bad when it is.
		 */
		target = s + sectors;
		roundup(s, bb->shift);
		rounddown(target, bb->shift);
		roundup(s, 1 << bb->shift);
		rounddown(target, 1 << bb->shift);
		sectors = target - s;
	}

@@ -1288,8 +1288,8 @@ static int _badblocks_check(struct badblocks *bb, sector_t s, int sectors,

		/* round the start down, and the end up */
		target = s + sectors;
		rounddown(s, bb->shift);
		roundup(target, bb->shift);
		rounddown(s, 1 << bb->shift);
		roundup(target, 1 << bb->shift);
		sectors = target - s;
	}