diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2017-12-29 17:49:13 +0100 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2017-12-29 17:49:13 +0100 |
commit | 70a02f840c5113cd9255ce4c1b1848bb48b0bd21 (patch) | |
tree | 1cd859500e4db4f4c44dadd908ce88c9b3f2a2b6 /drivers/char/mem.c | |
parent | 5f215d252496543ba22299bccef5062d30d63cfe (diff) | |
parent | 464e1d5f23cca236b930ef068c328a64cab78fb1 (diff) | |
download | linux-70a02f840c5113cd9255ce4c1b1848bb48b0bd21.tar.bz2 |
Merge tag 'v4.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 4.15-rc5
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 593a8818aca9..6aefe5370e5b 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/drivers/char/mem.c * @@ -342,6 +343,10 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma) size_t size = vma->vm_end - vma->vm_start; phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT; + /* Does it even fit in phys_addr_t? */ + if (offset >> PAGE_SHIFT != vma->vm_pgoff) + return -EINVAL; + /* It's illegal to wrap around the end of the physical address space. */ if (offset + (phys_addr_t)size - 1 < offset) return -EINVAL; |