Re: [PATCH] serial167.c: take 2: bugfixes and cleanups

From: Tigran Aivazian (
Date: Sat Aug 26 2000 - 04:17:40 EST

On Sat, 26 Aug 2000, Rogier Wolff wrote:
> Interfaces, interfaces, interfaces.....
> I suspect that this is one of the most common uses for copy_to_user.
> So wouldn't it make more sense to have copy_to_user (or a variant)
> return "EFAULT" when it doesn't work?
> That would make the code:
> return fcopy_to_user(retinfo, &tmp, sizeof (*retinfo));
> Looks cleaner to me than the EFAULT case.
> When you are "designing" copy_to_user, I can understand the desire to
> do something "useful" with the return value. If the majority of the
> callers don't do anything else with the non-zero return than return
> EFAULT, then that may instead be a good return value for the routine.
> I always try to write the code that calls the "support functions"
> first. As a programmer I'm lazy: I get to write clean code, knowing
> that the support functions will handle the details. In the end it pays
> off.

have a look at fs/super.c:copy_mount_options(), please. It does make use
of the return values from copy_from_user().


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:17 EST