summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorYue Hu <huyue2@yulong.com>2019-05-13 17:16:37 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-15 11:52:52 +0200
commitecadffd77d42180f8b53e33a2ed39083d79bac88 (patch)
tree65b3c27a5f19746ebedcb2675ba29cea17bb01e8 /mm
parent397b073f8d4f8f64cb16b2d80043934eeb369479 (diff)
downloadlinux-stable-ecadffd77d42180f8b53e33a2ed39083d79bac88.tar.gz
linux-stable-ecadffd77d42180f8b53e33a2ed39083d79bac88.tar.bz2
linux-stable-ecadffd77d42180f8b53e33a2ed39083d79bac88.zip
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.com Signed-off-by: Yue Hu <huyue2@yulong.com> Reviewed-by: Andrew 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/cma_debug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 8d7b2fd52225..a7dd9e8e10d5 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -56,7 +56,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
mutex_lock(&cma->lock);
for (;;) {
start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
- if (start >= cma->count)
+ if (start >= bitmap_maxno)
break;
end = find_next_bit(cma->bitmap, bitmap_maxno, start);
maxchunk = max(end - start, maxchunk);