[Devel] [PATCH RHEL8 COMMIT] cbt: Fix off-by-one in map_required_size()
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Dec 10 18:48:58 MSK 2019
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.6
------>
commit 6ce997aec3e18eea09ec6d851540c2a570fb319f
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue Dec 10 18:48:56 2019 +0300
cbt: Fix off-by-one in map_required_size()
find_last_bit() returns bit number, while we need
bits amount.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
block/blk-cbt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 171d3b5869b4..9d3a77fc3e56 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -326,6 +326,8 @@ static unsigned long map_required_size(struct page **map, unsigned long block_ma
bit = find_last_bit(page_address(map[page - 1]), PAGE_SIZE);
if (bit >= PAGE_SIZE)
bit = 0; /* Not found */
+ else
+ bit++;
return DIV_ROUND_UP(bit, 8) + page * PAGE_SIZE;
}
More information about the Devel
mailing list