Commit e7b92a6d authored by Yue Hu's avatar Yue Hu Committed by Greg Kroah-Hartman

mm/cma_debug.c: fix the break condition in cma_maxchunk_get()

[ Upstream commit f0fd50504a54f5548eb666dc16ddf8394e44e4b7 ]

If not find zero bit in find_next_zero_bit(), it will return the size
parameter passed in, so the start bit should be compared with bitmap_maxno
rather than cma->count.  Although getting maxchunk is working fine due to
zero value of order_per_bit currently, the operation will be stuck if
order_per_bit is set as non-zero.

Link: default avatarYue Hu <>
Reviewed-by: default avatarAndrew Morton <>
Cc: Michal Hocko <>
Cc: Joe Perches <>
Cc: David Rientjes <>
Cc: Dmitry Safonov <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
Signed-off-by: default avatarSasha Levin <>
parent 20fbb34e
......@@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
for (;;) {
start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
if (start >= cma->count)
if (start >= bitmap_maxno)
end = find_next_bit(cma->bitmap, bitmap_maxno, start);
maxchunk = max(end - start, maxchunk);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment