aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/tile/kernel/module.c2
-rw-r--r--drivers/lguest/core.c7
-rw-r--r--drivers/staging/android/binder.c4
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--mm/vmalloc.c14
-rw-r--r--mm/zsmalloc.c2
6 files changed, 11 insertions, 20 deletions
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index 4918d91bc3a6..d19b13e3a59f 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -58,7 +58,7 @@ void *module_alloc(unsigned long size)
58 area->nr_pages = npages; 58 area->nr_pages = npages;
59 area->pages = pages; 59 area->pages = pages;
60 60
61 if (map_vm_area(area, prot_rwx, &pages)) { 61 if (map_vm_area(area, prot_rwx, pages)) {
62 vunmap(area->addr); 62 vunmap(area->addr);
63 goto error; 63 goto error;
64 } 64 }
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 0bf1e4edf04d..6590558d1d31 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -42,7 +42,6 @@ DEFINE_MUTEX(lguest_lock);
42static __init int map_switcher(void) 42static __init int map_switcher(void)
43{ 43{
44 int i, err; 44 int i, err;
45 struct page **pagep;
46 45
47 /* 46 /*
48 * Map the Switcher in to high memory. 47 * Map the Switcher in to high memory.
@@ -110,11 +109,9 @@ static __init int map_switcher(void)
110 * This code actually sets up the pages we've allocated to appear at 109 * This code actually sets up the pages we've allocated to appear at
111 * switcher_addr. map_vm_area() takes the vma we allocated above, the 110 * switcher_addr. map_vm_area() takes the vma we allocated above, the
112 * kind of pages we're mapping (kernel pages), and a pointer to our 111 * kind of pages we're mapping (kernel pages), and a pointer to our
113 * array of struct pages. It increments that pointer, but we don't 112 * array of struct pages.
114 * care.
115 */ 113 */
116 pagep = lg_switcher_pages; 114 err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, lg_switcher_pages);
117 err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep);
118 if (err) { 115 if (err) {
119 printk("lguest: map_vm_area failed: %i\n", err); 116 printk("lguest: map_vm_area failed: %i\n", err);
120 goto free_vma; 117 goto free_vma;
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 02b0379ae550..4f34dc0095b5 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -585,7 +585,6 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
585 585
586 for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) { 586 for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) {
587 int ret; 587 int ret;
588 struct page **page_array_ptr;
589 588
590 page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; 589 page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE];
591 590
@@ -598,8 +597,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
598 } 597 }
599 tmp_area.addr = page_addr; 598 tmp_area.addr = page_addr;
600 tmp_area.size = PAGE_SIZE + PAGE_SIZE /* guard page? */; 599 tmp_area.size = PAGE_SIZE + PAGE_SIZE /* guard page? */;
601 page_array_ptr = page; 600 ret = map_vm_area(&tmp_area, PAGE_KERNEL, page);
602 ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
603 if (ret) { 601 if (ret) {
604 pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n", 602 pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n",
605 proc->pid, page_addr); 603 proc->pid, page_addr);
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b8a89189a29..b87696fdf06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -113,7 +113,7 @@ extern struct vm_struct *remove_vm_area(const void *addr);
113extern struct vm_struct *find_vm_area(const void *addr); 113extern struct vm_struct *find_vm_area(const void *addr);
114 114
115extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 115extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
116 struct page ***pages); 116 struct page **pages);
117#ifdef CONFIG_MMU 117#ifdef CONFIG_MMU
118extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 118extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
119 pgprot_t prot, struct page **pages); 119 pgprot_t prot, struct page **pages);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 9ec4173f48a8..2b0aa5486092 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1270,19 +1270,15 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)
1270} 1270}
1271EXPORT_SYMBOL_GPL(unmap_kernel_range); 1271EXPORT_SYMBOL_GPL(unmap_kernel_range);
1272 1272
1273int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) 1273int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page **pages)
1274{ 1274{
1275 unsigned long addr = (unsigned long)area->addr; 1275 unsigned long addr = (unsigned long)area->addr;
1276 unsigned long end = addr + get_vm_area_size(area); 1276 unsigned long end = addr + get_vm_area_size(area);
1277 int err; 1277 int err;
1278 1278
1279 err = vmap_page_range(addr, end, prot, *pages); 1279 err = vmap_page_range(addr, end, prot, pages);
1280 if (err > 0) {
1281 *pages += err;
1282 err = 0;
1283 }
1284 1280
1285 return err; 1281 return err > 0 ? 0 : err;
1286} 1282}
1287EXPORT_SYMBOL_GPL(map_vm_area); 1283EXPORT_SYMBOL_GPL(map_vm_area);
1288 1284
@@ -1548,7 +1544,7 @@ void *vmap(struct page **pages, unsigned int count,
1548 if (!area) 1544 if (!area)
1549 return NULL; 1545 return NULL;
1550 1546
1551 if (map_vm_area(area, prot, &pages)) { 1547 if (map_vm_area(area, prot, pages)) {
1552 vunmap(area->addr); 1548 vunmap(area->addr);
1553 return NULL; 1549 return NULL;
1554 } 1550 }
@@ -1606,7 +1602,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
1606 cond_resched(); 1602 cond_resched();
1607 } 1603 }
1608 1604
1609 if (map_vm_area(area, prot, &pages)) 1605 if (map_vm_area(area, prot, pages))
1610 goto fail; 1606 goto fail;
1611 return area->addr; 1607 return area->addr;
1612 1608
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index fe78189624cf..bb62a4adc328 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -690,7 +690,7 @@ static inline void __zs_cpu_down(struct mapping_area *area)
690static inline void *__zs_map_object(struct mapping_area *area, 690static inline void *__zs_map_object(struct mapping_area *area,
691 struct page *pages[2], int off, int size) 691 struct page *pages[2], int off, int size)
692{ 692{
693 BUG_ON(map_vm_area(area->vm, PAGE_KERNEL, &pages)); 693 BUG_ON(map_vm_area(area->vm, PAGE_KERNEL, pages));
694 area->vm_addr = area->vm->addr; 694 area->vm_addr = area->vm->addr;
695 return area->vm_addr + off; 695 return area->vm_addr + off;
696} 696}