lkml.org 
[lkml]   [2010]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUGFIX][PATCH] pagemap: set pagemap walk limit to PMD boundary
> > @@ -776,7 +777,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
> > unsigned long end;
> >
> > pm.pos = 0;
> > - end = start_vaddr + PAGEMAP_WALK_SIZE;
> > + end = (start_vaddr + PAGEMAP_WALK_SIZE) & PAGEMAP_WALK_MASK;
> > /* overflow ? */
> > if (end < start_vaddr || end > end_vaddr)
> > end = end_vaddr;
>
> Ack.
>
> But ALIGN() can't be used ?

ALIGN() returns the same address as the input if it is already aligned,
but what we need here is the next PMD boundary. So something like

end = IS_ALIGNED(start_vaddr, PAGEMAP_WALK_SIZE) ?
start_vaddr + PAGEMAP_WALK_SIZE :
ALIGN(start_vaddr, PAGEMAP_WALK_SIZE)

keeps the semantics, but I don't like it because it's lengthy.

Anyway, thanks for your comment.

Naoya Horiguchi


\
 
 \ /
  Last update: 2010-11-22 05:13    [W:0.046 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site