Skip to content

Commit

Permalink
mm/madvise.c: use PAGE_ALIGN[ED] for range checking
Browse files Browse the repository at this point in the history
Improve readability, no functional change.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Wei Yang <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wei Yang authored and torvalds committed Dec 1, 2019
1 parent d3cd257 commit df6c650
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,9 +1059,9 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
if (!madvise_behavior_valid(behavior))
return error;

if (start & ~PAGE_MASK)
if (!PAGE_ALIGNED(start))
return error;
len = (len_in + ~PAGE_MASK) & PAGE_MASK;
len = PAGE_ALIGN(len_in);

/* Check to see whether len was rounded up from small -ve to zero */
if (len_in && !len)
Expand Down

0 comments on commit df6c650

Please sign in to comment.