Skip to content

Commit 7d83c5d

Browse files
Li Nanaxboe
authored andcommitted
badblocks: Fix error shitf ops
'bb->shift' is used directly in badblocks. It is wrong, fix it. Fixes: 3ea3354 ("badblocks: improve badblocks_check() for multiple ranges handling") Signed-off-by: Li Nan <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Acked-by: Coly Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 85f7292 commit 7d83c5d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

block/badblocks.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@ static int _badblocks_set(struct badblocks *bb, sector_t s, int sectors,
880880
/* round the start down, and the end up */
881881
sector_t next = s + sectors;
882882

883-
rounddown(s, bb->shift);
884-
roundup(next, bb->shift);
883+
rounddown(s, 1 << bb->shift);
884+
roundup(next, 1 << bb->shift);
885885
sectors = next - s;
886886
}
887887

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

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

12891289
/* round the start down, and the end up */
12901290
target = s + sectors;
1291-
rounddown(s, bb->shift);
1292-
roundup(target, bb->shift);
1291+
rounddown(s, 1 << bb->shift);
1292+
roundup(target, 1 << bb->shift);
12931293
sectors = target - s;
12941294
}
12951295

0 commit comments

Comments
 (0)