Re: AUDIT: copy_from_user is a deathtrap.

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Fri May 17 2002 - 20:26:48 EST


In message <E178j5g-0006en-00@the-village.bc.nu> you write:
> > We could do that, or, we could fix the actual problem, which is the
> > HUGE FUCKING BEARTRAP WHICH CATCHES EVERY SINGLE NEW PROGRAMMER ON THE
> > WAY THROUGH.
>
> Capital letters versus content. I'd prefer content

1) Returning 0 on success, and -errno on error is a common kernel
   convention.

2) Following kernel conventions makes it easier for other programmers
   to use your code.

3) You should only violate kernel conventions when there is a
   compelling reason.

        1a) If you're going to break a convention, do it in a way that
            breaks compile, or
        1b) If you can't do that, make it reliably break at runtime.

4) The single case which requires this information can be fixed by a
   simple 10-line wrapper function.

I do not believe this is a compelling reason to violate kernel
convention in a way which is almost impossible to notice. I furthur
believe that it speaks very poorly about the thought put into kernel
interface design.

> All the cases I looked at where replications of existing bugs copied from
> old drivers.

Try looking at intermezzo, or the s390 and s390x ports. New code, new
coders, same trap.

Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
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/



This archive was generated by hypermail 2b29 : Thu May 23 2002 - 22:00:15 EST