提交 13e1ea08 编写于 作者: Y Yue Hu 提交者: 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: http://lkml.kernel.org/r/20190319092734.276-1-zbestahu@gmail.comSigned-off-by: NYue Hu <huyue2@yulong.com>
Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Joe Perches <joe@perches.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dmitry Safonov <d.safonov@partner.samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 38c5fce7
...@@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val) ...@@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
mutex_lock(&cma->lock); mutex_lock(&cma->lock);
for (;;) { for (;;) {
start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
if (start >= cma->count) if (start >= bitmap_maxno)
break; break;
end = find_next_bit(cma->bitmap, bitmap_maxno, start); end = find_next_bit(cma->bitmap, bitmap_maxno, start);
maxchunk = max(end - start, maxchunk); maxchunk = max(end - start, maxchunk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册