lkml.org 
[lkml]   [2000]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cleanup on selection.c


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.

Linus

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

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.080 / U:7.480 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site