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: bugfixes and cleanups
On Sat, 26 Aug 2000, Philipp Rumpf wrote:

> On Fri, Aug 25, 2000 at 11:04:05PM +0100, Tigran Aivazian wrote:
> > Hi Arnaldo,
> >
> > On Fri, 25 Aug 2000, Arnaldo Carvalho de Melo wrote:
> > > - copy_to_user(retinfo,&tmp,sizeof(*retinfo));
> > > + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
> > > + return -EFAULT;
> > > return 0;
> >
> > I think Linus already suggested that you do this:
> >
> > return copy_to_user(...) ? -EFAULT : 0;
> >
> > it is compact and intuitive.
>
> I'm not too sure about that. If you want to do more things than a single
> copy,
>
> if (copy_to_user(...))
> return -EFAULT;
>
> ...;
>
> return 0;
>
> is obviously required.

I did think of that, of course, before commenting - the reason I commented
is precisely because in his specific case using the short one-line form is
the right thing to do.

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.438 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site