Skip to content

Commit

Permalink
mm/util: use offset_in_page macro
Browse files Browse the repository at this point in the history
linux/mm.h provides offset_in_page() macro.  Let's use already predefined
macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Alexander Kuleshov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
0xAX authored and torvalds committed Nov 6, 2015
1 parent f09f124 commit ea53cde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ unsigned long vm_mmap(struct file *file, unsigned long addr,
{
if (unlikely(offset + PAGE_ALIGN(len) < offset))
return -EINVAL;
if (unlikely(offset & ~PAGE_MASK))
if (unlikely(offset_in_page(offset)))
return -EINVAL;

return vm_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
Expand Down

0 comments on commit ea53cde

Please sign in to comment.