]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/gup_benchmark.c
mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio()
[mirror_ubuntu-bionic-kernel.git] / mm / gup_benchmark.c
index 0f44759486e22e68ce88c9d73a4fdecd7eb925aa..33be0b5762d34a6320108cf703c0ed6568d444d7 100644 (file)
@@ -19,9 +19,13 @@ 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;
 
+       if (gup->size > ULONG_MAX)
+               return -EINVAL;
+
        nr_pages = gup->size / PAGE_SIZE;
        pages = kvzalloc(sizeof(void *) * nr_pages, GFP_KERNEL);
        if (!pages)