Re: [BUGFIX][PATCH] pagemap: set pagemap walk limit to PMD boundary

From: Naoya Horiguchi
Date: Sun Nov 21 2010 - 23:11:16 EST


> > @@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/