Skip to content

Commit

Permalink
mm/gup_benchmark: fix unsigned comparison to zero in __gup_benchmark_…
Browse files Browse the repository at this point in the history
…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: 09e35a4 ("mm/gup_benchmark: handle gup failures")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
YueHaibing authored and Greg Kroah-Hartman committed Oct 5, 2018
1 parent e125fe4 commit 5189686
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/gup_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5189686

Please sign in to comment.