Messages in this thread |  | | Date | Sat, 26 Aug 2000 10:17:40 +0100 (BST) | From | Tigran Aivazian <> | Subject | Re: [PATCH] serial167.c: take 2: bugfixes and cleanups |
| |
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().
Regards, Tigran
- 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/
|  |