From: YueHaibing <yuehaibing@huawei.com>
To: akpm@linux-foundation.org, mst@redhat.com, keescook@chromium.org,
kirill.shutemov@linux.intel.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH -next] mm/gup_benchmark: Fix unsigned comparison to zero in __gup_benchmark_ioctl
Date: Fri, 21 Sep 2018 17:50:15 +0800 [thread overview]
Message-ID: <20180921095015.26088-1-yuehaibing@huawei.com> (raw)
get_user_pages_fast will return negative value if no pages were pinned,
then be converted to a unsigned, which is compared to zero, giving
the wrong result.
Fixes: 09e35a4a1ca8 ("mm/gup_benchmark: handle gup failures")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
mm/gup_benchmark.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c
index 6a47370..7405c9d8 100644
--- a/mm/gup_benchmark.c
+++ b/mm/gup_benchmark.c
@@ -19,7 +19,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd,
struct gup_benchmark *gup)
{
ktime_t start_time, end_time;
- unsigned long i, nr, nr_pages, addr, next;
+ unsigned long i, nr_pages, addr, next;
+ int nr;
struct page **pages;
nr_pages = gup->size / PAGE_SIZE;
--
2.7.0
reply other threads:[~2018-09-21 9:50 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=20180921095015.26088-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.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