lkml.org 
[lkml]   [2023]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/25] ALSA: core: Add memory copy helpers between iov_iter and iomem
On Tue, 15 Aug 2023 15:51:30 +0200,
Andy Shevchenko wrote:
>
> On Mon, Aug 14, 2023 at 01:55:01PM +0200, Takashi Iwai wrote:
> > Add two more helpers for copying memory between iov_iter and iomem,
> > which will be used by the new PCM copy ops in a few drivers.
> > The existing helpers became wrappers of those now.
> >
> > Note that copy_from/to_iter() returns the copied bytes, hence the
> > error condition is inverted from copy_from/to_user().
>
> ...
>
> > - return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
> > + return !copy_to_iter((const void __force *)src, count, dst) ? -EFAULT : 0;
>
> Inverted means, I believe, this
>
> return copy_to_iter((const void __force *)src, count, dst) == count ? 0 : -EFAULT;
>
> as far as I understand the idea behind the copy_to_user() return value.
>
> Ditto for other cases.

OK, this looks more correct. I'll fix in v2.


thanks,

Takashi

\
 
 \ /
  Last update: 2023-08-15 15:56    [W:0.482 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site