lkml.org 
[lkml]   [2000]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

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