X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=mm%2Fgup_benchmark.c;h=0f44759486e22e68ce88c9d73a4fdecd7eb925aa;hb=fc5ee888ab2a5396ec1f5113a4860f1aafc08ecf;hp=5c8e2abeaa1598afbe0462762db25d2a017d814a;hpb=866c9b94ef968445c52214b3748ecc52a8491bca;p=mirror_ubuntu-bionic-kernel.git diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c index 5c8e2abeaa15..0f44759486e2 100644 --- a/mm/gup_benchmark.c +++ b/mm/gup_benchmark.c @@ -23,7 +23,7 @@ static int __gup_benchmark_ioctl(unsigned int cmd, struct page **pages; nr_pages = gup->size / PAGE_SIZE; - pages = kvmalloc(sizeof(void *) * nr_pages, GFP_KERNEL); + pages = kvzalloc(sizeof(void *) * nr_pages, GFP_KERNEL); if (!pages) return -ENOMEM; @@ -41,6 +41,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd, } nr = get_user_pages_fast(addr, nr, gup->flags & 1, pages + i); + if (nr <= 0) + break; i += nr; } end_time = ktime_get();