Re: [PATCH 03/25] ALSA: core: Add memory copy helpers between iov_iter and iomem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux