dm persistent data: use the "end" value in sm_ll_find_common_free_block
Mikulas Patocka
maintainerPATCH 1/1 dm persistent data: use the "end" value in sm_ll_find_common_free_block
sm_ll_find_common_free_block would ignore the argument "end". It didn't cause any data corruption, it just scanned more data than needed. This commit makes it stop at the "end" argument. In case the caller supplies wild value, this commit still clips it to new_ll->nr_blocks.
Signed-off-by Mikulas Patocka <[email protected]>
Assisted-by Claude:claude-opus-5
--- drivers/md/persistent-data/dm-space-map-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/persistent-data/dm-space-map-common.c +1 -1
@@ -397,7 +397,7 @@ int sm_ll_find_common_free_block(structuint32_t count; do { - r = sm_ll_find_free_block(new_ll, begin, new_ll->nr_blocks, b); + r = sm_ll_find_free_block(new_ll, begin, min(end, new_ll->nr_blocks), b); if (r) break;