kprobes: fix error checking of batch registration
[pandora-kernel.git] / mm / madvise.c
index e75096b..23a0ec3 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/syscalls.h>
 #include <linux/mempolicy.h>
 #include <linux/hugetlb.h>
+#include <linux/sched.h>
 
 /*
  * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -111,7 +112,7 @@ static long madvise_willneed(struct vm_area_struct * vma,
        if (!file)
                return -EBADF;
 
-       if (file->f_mapping->a_ops->get_xip_page) {
+       if (file->f_mapping->a_ops->get_xip_mem) {
                /* no bad return value, but ignore advice */
                return 0;
        }
@@ -286,9 +287,11 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
        struct vm_area_struct * vma, *prev;
        int unmapped_error = 0;
        int error = -EINVAL;
+       int write;
        size_t len;
 
-       if (madvise_need_mmap_write(behavior))
+       write = madvise_need_mmap_write(behavior);
+       if (write)
                down_write(&current->mm->mmap_sem);
        else
                down_read(&current->mm->mmap_sem);
@@ -353,7 +356,7 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
                        vma = find_vma(current->mm, start);
        }
 out:
-       if (madvise_need_mmap_write(behavior))
+       if (write)
                up_write(&current->mm->mmap_sem);
        else
                up_read(&current->mm->mmap_sem);