]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/gup_benchmark.c
x86/speculation/mds: Add mitigation control for MDS
[mirror_ubuntu-bionic-kernel.git] / mm / gup_benchmark.c
index 5c8e2abeaa1598afbe0462762db25d2a017d814a..0f44759486e22e68ce88c9d73a4fdecd7eb925aa 100644 (file)
@@ -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();