diff options
author | Brian Norris <computersforpeace@gmail.com> | 2017-06-01 13:53:55 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2017-06-01 13:53:55 -0400 |
commit | 05e97a9eda72d58dba293857df6aac62584ef99a (patch) | |
tree | e86e692f26d4879ff2210c54722e2b7780210249 /drivers/char/mem.c | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) | |
parent | d4ed3b9015b5eebc90d629579d9e7944607cbae5 (diff) |
Merge tag 'nand/fixes-for-4.12-rc3' of git://git.infradead.org/linux-mtd into MTD
From Boris:
"""
This pull request contains several fixes to the core and the tango
driver.
tango fixes:
* Add missing MODULE_DEVICE_TABLE() in tango_nand.c
* Update the number of corrected bitflips
core fixes:
* Fix a long standing memory leak in nand_scan_tail()
* Fix several bugs introduced by the per-vendor init/detection
infrastructure (introduced in 4.12)
* Add a static specifier to nand_ooblayout_lp_hamming_ops definition
"""
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 7e4a9d1296bb..6e0cbe092220 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -340,6 +340,11 @@ static const struct vm_operations_struct mmap_mem_ops = { | |||
340 | static int mmap_mem(struct file *file, struct vm_area_struct *vma) | 340 | static int mmap_mem(struct file *file, struct vm_area_struct *vma) |
341 | { | 341 | { |
342 | size_t size = vma->vm_end - vma->vm_start; | 342 | size_t size = vma->vm_end - vma->vm_start; |
343 | phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT; | ||
344 | |||
345 | /* It's illegal to wrap around the end of the physical address space. */ | ||
346 | if (offset + (phys_addr_t)size < offset) | ||
347 | return -EINVAL; | ||
343 | 348 | ||
344 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) | 349 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) |
345 | return -EINVAL; | 350 | return -EINVAL; |