Em Fri, Aug 25, 2000 at 10:07:03AM -0700, Linus Torvalds escreveu:
>
>
> On Fri, 25 Aug 2000, Arnaldo Carvalho de Melo wrote:
> >
> > nope, look at copy_from_user_ret in include/asm/uaccess.h
>
> .. quite frankly, we should be getting _rid_ of that horribly ugly
> construct. We should NOT add to it.
>
> The copy_from_user_ret() define is both BUGGY and UGLY: it's buggy because
> it is done as a statement expression even though it's not actually an
> expression at all.
>
> It is ugly because it fails to honour _any_ of the good rules of
> programming: it looks like a function, not a #define (as shown by the
> case), and it has non-function-behaviour.
>
> In short, avoid it like the plague. Anything that contains it is _not_ a
> cleanup, but an addign of warts. The only users of that construct from
> hell are basically bad drivers.
>
> Please just use the obvious code instead:
>
> return copy_from_user(to,from,n) ? -EFAULT : 0;
>
> and don't use the silly macro that some broken drivers insist on using.
Ok, I'll stop using it in the cleanups and start sending patches to the
maintainers, then get rid of it completely.
Good to have feedback.
- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:16 EST