linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yue Hu <zbestahu@gmail.com>
To: akpm@linux-foundation.org, mhocko@suse.com, joe@perches.com,
	rientjes@google.com
Cc: linux-mm@kvack.org, huyue2@yulong.com, dongjian@yulong.com
Subject: [PATCH] mm/cma_debug.c: fix the break condition in cma_maxchunk_get()
Date: Tue, 19 Mar 2019 17:27:34 +0800	[thread overview]
Message-ID: <20190319092734.276-1-zbestahu@gmail.com> (raw)

From: Yue Hu <huyue2@yulong.com>

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.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 mm/cma_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index f234672..3b69248 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -58,7 +58,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);
-- 
1.9.1


                 reply	other threads:[~2019-03-19  9:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190319092734.276-1-zbestahu@gmail.com \
    --to=zbestahu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dongjian@yulong.com \
    --cc=huyue2@yulong.com \
    --cc=joe@perches.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox