]>
Commit | Line | Data |
---|---|---|
37554d48 SL |
1 | From 6f8b1f3fc9c7097cf634336450e91f1a21a5444c Mon Sep 17 00:00:00 2001 |
2 | From: Yue Hu <huyue2@yulong.com> | |
3 | Date: Mon, 13 May 2019 17:16:37 -0700 | |
4 | Subject: mm/cma_debug.c: fix the break condition in cma_maxchunk_get() | |
5 | ||
6 | [ Upstream commit f0fd50504a54f5548eb666dc16ddf8394e44e4b7 ] | |
7 | ||
8 | If not find zero bit in find_next_zero_bit(), it will return the size | |
9 | parameter passed in, so the start bit should be compared with bitmap_maxno | |
10 | rather than cma->count. Although getting maxchunk is working fine due to | |
11 | zero value of order_per_bit currently, the operation will be stuck if | |
12 | order_per_bit is set as non-zero. | |
13 | ||
14 | Link: http://lkml.kernel.org/r/20190319092734.276-1-zbestahu@gmail.com | |
15 | Signed-off-by: Yue Hu <huyue2@yulong.com> | |
16 | Reviewed-by: Andrew Morton <akpm@linux-foundation.org> | |
17 | Cc: Michal Hocko <mhocko@suse.com> | |
18 | Cc: Joe Perches <joe@perches.com> | |
19 | Cc: David Rientjes <rientjes@google.com> | |
20 | Cc: Dmitry Safonov <d.safonov@partner.samsung.com> | |
21 | Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> | |
22 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
23 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
24 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
25 | --- | |
26 | mm/cma_debug.c | 2 +- | |
27 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
28 | ||
29 | diff --git a/mm/cma_debug.c b/mm/cma_debug.c | |
30 | index ad6723e9d110..3e0415076cc9 100644 | |
31 | --- a/mm/cma_debug.c | |
32 | +++ b/mm/cma_debug.c | |
33 | @@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val) | |
34 | mutex_lock(&cma->lock); | |
35 | for (;;) { | |
36 | start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); | |
37 | - if (start >= cma->count) | |
38 | + if (start >= bitmap_maxno) | |
39 | break; | |
40 | end = find_next_bit(cma->bitmap, bitmap_maxno, start); | |
41 | maxchunk = max(end - start, maxchunk); | |
42 | -- | |
43 | 2.20.1 | |
44 |