Re: [PATCH] cleanup on selection.c

From: Linus Torvalds (
Date: Fri Aug 25 2000 - 12:07:03 EST

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.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:16 EST