x86: coding style fixes to arch/x86/kernel/crash_dump_64.c
[pandora-kernel.git] / mm / mprotect.c
index acfe7c8..abd645a 100644 (file)
@@ -153,12 +153,10 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
         * If we make a private mapping writable we increase our commit;
         * but (without finer accounting) cannot reduce our commit if we
         * make it unwritable again.
-        *
-        * FIXME? We haven't defined a VM_NORESERVE flag, so mprotecting
-        * a MAP_NORESERVE private mapping to writable will now reserve.
         */
        if (newflags & VM_WRITE) {
-               if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED))) {
+               if (!(oldflags & (VM_ACCOUNT|VM_WRITE|
+                                               VM_SHARED|VM_NORESERVE))) {
                        charged = nrpages;
                        if (security_vm_enough_memory(charged))
                                return -ENOMEM;
@@ -237,7 +235,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
        end = start + len;
        if (end <= start)
                return -ENOMEM;
-       if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM))
+       if (!arch_validate_prot(prot))
                return -EINVAL;
 
        reqprot = prot;