Commit 51896864 authored by YueHaibing's avatar YueHaibing Committed by Greg Kroah-Hartman

mm/gup_benchmark: fix unsigned comparison to zero in __gup_benchmark_ioctl

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.

Link: http://lkml.kernel.org/r/20180921095015.26088-1-yuehaibing@huawei.com
Fixes: 09e35a4a ("mm/gup_benchmark: handle gup failures")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e125fe40
...@@ -19,7 +19,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd, ...@@ -19,7 +19,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd,
struct gup_benchmark *gup) struct gup_benchmark *gup)
{ {
ktime_t start_time, end_time; 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; struct page **pages;
nr_pages = gup->size / PAGE_SIZE; nr_pages = gup->size / PAGE_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment