Re: AUDIT: copy_from_user is a deathtrap.

Andi Kleen (ak@suse.de)
20 May 2002 12:59:23 +0200


Rusty Russell <rusty@rustcorp.com.au> writes:

> In message <Pine.LNX.4.44.0205191951460.22433-100000@home.transmeta.com> you wr
> ite:
> > ret = copy_from_user(xxx);
> > if (ret)
> > return ret;
> >
> > which is apparently your suggestion.
>
> Not quite:
> copy_from_user(xxx);
>
> Is my suggestion. No error return.

I don't think it is a good idea. Consider a driver that does lots
of small copy_from_user() from user space for a longer write (e.g. TCP
to a small MSS) If xxx was faulting it would eat a lot of cycles with
faulting again and again.

-Andi

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