lkml.org 
[lkml]   [2002]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: AUDIT: copy_from_user is a deathtrap.
Date
> On 22 May 02 at 12:27, Denis Vlasenko wrote:
> > > As Linus and others pointed out, copy_{to_from}_user has its uses and
> > > will stay, but something like:
> >
> > I don't say 'kill it', I say 'rename it so that its name tells users what
> > return value to expect'. However, one have to weigh
>
> Why?

Why what? Why rename copy_to_user? Because in its current form people
misunderstand its return value and misuse it.
We can keep unmodified version of copy_to_user for some time for
compatibility.

Or maybe your "why?" is related to something else, I fail
to understand you in that case.

> From copyin/out descriptions sent yesterday if you want same source code
> running on all (BSD,SVR4,OSF/1) platforms, you must do
>
> if (copyin()) return [-]EFAULT;

But if I am new to Linux and just want to write my first piece of kernel
code, copyout() is even worse than copy_to_user():
it too lacks info of what it can return (0/1, 0/-EFAULT, # of copied bytes,
# of bytes remaining?) *and* copy direction become unclear:
copy out of *what*? out of kernel memery? out of user memory?
--
vda
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.048 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site