Re: AUDIT: copy_from_user is a deathtrap.

Rusty Russell
2002-05-18T01:23:53Z

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.