lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNuE5UunDd40e8vW@smile.fi.intel.com>
Date:   Tue, 15 Aug 2023 17:00:05 +0300
From:   Andy Shevchenko <andriy.shevchenko@...el.com>
To:     Takashi Iwai <tiwai@...e.de>
Cc:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        Lars-Peter Clausen <lars@...afoo.de>,
        Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH 21/25] ASoC: dmaengine: Convert to generic PCM copy ops

On Mon, Aug 14, 2023 at 01:55:19PM +0200, Takashi Iwai wrote:
> This patch converts the ASoC dmaenging driver code to use the new
> unified PCM copy callback.  It's a straightforward conversion from
> *_user() to *_iter() variants.
> 
> The process callback is still using the direct pointer as of now, but
> it'll be converted in the next patch.
> 
> Note that copy_from/to_iter() returns the copied bytes, hence the
> error condition is inverted from copy_from/to_user().

...

>  	if (is_playback)
> -		if (copy_from_user(dma_ptr, buf, bytes))
> +		if (!copy_from_iter(dma_ptr, bytes, buf))

!= bytes ?

>  			return -EFAULT;

Can be compressed to a single conditional:

	if (is_playback && copy_from_iter(dma_ptr, bytes, buf) != bytes)

...

>  	if (!is_playback)
> -		if (copy_to_user(buf, dma_ptr, bytes))
> +		if (!copy_to_iter(dma_ptr, bytes, buf))
>  			return -EFAULT;

As per above.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ