diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2019-11-13 23:10:52 +0100 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2019-11-13 23:10:52 +0100 |
| commit | 1566a6a30bf4d85849bab7e389392d6d3de1530e (patch) | |
| tree | bbc979f430cb07d41f7b35524027e25e7a4b9fe6 /drivers/android/binder_alloc.c | |
| parent | 3af50e548019f6ee26d0ed4340f4ab980f884696 (diff) | |
| parent | d6d5df1db6e9d7f8f76d2911707f7d5877251b02 (diff) | |
| download | linux-1566a6a30bf4d85849bab7e389392d6d3de1530e.tar.gz linux-1566a6a30bf4d85849bab7e389392d6d3de1530e.tar.bz2 linux-1566a6a30bf4d85849bab7e389392d6d3de1530e.zip | |
Merge tag 'v5.4-rc5' into devel
Linux 5.4-rc5
Diffstat (limited to 'drivers/android/binder_alloc.c')
| -rw-r--r-- | drivers/android/binder_alloc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index d42a8b2f636a..eb76a823fbb2 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -22,6 +22,7 @@ #include <asm/cacheflush.h> #include <linux/uaccess.h> #include <linux/highmem.h> +#include <linux/sizes.h> #include "binder_alloc.h" #include "binder_trace.h" @@ -689,7 +690,9 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, alloc->buffer = (void __user *)vma->vm_start; mutex_unlock(&binder_alloc_mmap_lock); - alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE, + alloc->buffer_size = min_t(unsigned long, vma->vm_end - vma->vm_start, + SZ_4M); + alloc->pages = kcalloc(alloc->buffer_size / PAGE_SIZE, sizeof(alloc->pages[0]), GFP_KERNEL); if (alloc->pages == NULL) { @@ -697,7 +700,6 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, failure_string = "alloc page array"; goto err_alloc_pages_failed; } - alloc->buffer_size = vma->vm_end - vma->vm_start; buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); if (!buffer) { |
