]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/char/mem.c
Merge branch 'ufs-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[karo-tx-linux.git] / drivers / char / mem.c
index 6e0cbe09222059f0d8e8ccf821edfee5c575703e..593a8818aca99e345e03d0fb56eabd25b5ffd05a 100644 (file)
@@ -343,7 +343,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
        phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
 
        /* It's illegal to wrap around the end of the physical address space. */
-       if (offset + (phys_addr_t)size < offset)
+       if (offset + (phys_addr_t)size - 1 < offset)
                return -EINVAL;
 
        if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))