lkml.org 
[lkml]   [2016]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v14] x86, mce: Add memcpy_mcsafe()

* Tony Luck <tony.luck@gmail.com> wrote:

> On Thu, Mar 10, 2016 at 11:37 AM, Luck, Tony <tony.luck@intel.com> wrote:
> >> But you return 0 == false for success and 1 == true for failure.
> >
> > Aaargh! -ETOOMUCHSHELLSCRIPTPROGRAMMING
> >
> > -Tony
>
> Options to fix this:
> 1) Just change the comments in the code.
> This seems like it would confuse people as I thing most people
> would expect the "true" return to mean the copy succeeded.
> 2) Reverse the return values.
> Better that option 1 - but doesn't leave scope to return a count
> if some future user does want to know where the copy failed.
> 3) Change the return type back from "bool" to "int"
> 0 == success, non-zero == fail (with option to put the non-copied
> byte count in later).
> 4) Something else

Please use the copy_*_user() memory copying API semantics, which are: return
negative code (-EFAULT) on error, 0 on success.

Don't return 1 and please don't use bools for any memory copy library
functionality.

Thanks,

Ingo

\
 
 \ /
  Last update: 2016-03-12 19:01    [W:0.101 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site