Re: [GIT pull] futex fixes for 2.6.31

From: Ingo Molnar
Date: Thu Jun 25 2009 - 06:04:40 EST



* Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> On Thu, 25 Jun 2009, Zhang, Yanmin wrote:
> > On Wed, 2009-06-24 at 21:48 +0200, Thomas Gleixner wrote:
> > > +static int fault_in_user_writeable(u32 __user *uaddr)
> > > +{
> > > + int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
> > > + sizeof(*uaddr), 1, 0, NULL, NULL);
> > The 4th parameter of get_user_pages means page number. ïsizeof(*uaddr) is equal to
> > 4, so you want 4 pages?
>
> Grrr. I looked up the prototype of it in include/linux/mm.h:
>
> int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
> unsigned long start, int len, int write, int force,
> struct page **pages, struct vm_area_struct **vmas);
>
> len == number of pages ! How intutitive. :(
>
> I guess Linus tripped over it as well. See:
> http://lkml.org/lkml/2009/6/21/95

heh, and then i suggested to you to change the '4' to sizeof(u32)
;-)

Ingo
--
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/