diff mbox series

[v5,01/11] sound: Fix snd_pcm_readv()/writev() to use iov access functions

Message ID 20230920222231.686275-2-dhowells@redhat.com (mailing list archive)
State New, archived
Headers show
Series iov_iter: Convert the iterator macros into inline funcs | expand

Commit Message

David Howells Sept. 20, 2023, 10:22 p.m. UTC
Fix snd_pcm_readv()/writev() to use iov access functions rather than poking
at the iov_iter internals directly.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jaroslav Kysela <perex@perex.cz>
cc: Takashi Iwai <tiwai@suse.com>
cc: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
cc: Jens Axboe <axboe@kernel.dk>
cc: Suren Baghdasaryan <surenb@google.com>
cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
cc: alsa-devel@alsa-project.org
---
 sound/core/pcm_native.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jaroslav Kysela Sept. 21, 2023, 6:08 a.m. UTC | #1
On 21. 09. 23 0:22, David Howells wrote:
> Fix snd_pcm_readv()/writev() to use iov access functions rather than poking
> at the iov_iter internals directly.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jaroslav Kysela <perex@perex.cz>
> cc: Takashi Iwai <tiwai@suse.com>
> cc: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> cc: Jens Axboe <axboe@kernel.dk>
> cc: Suren Baghdasaryan <surenb@google.com>
> cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> cc: alsa-devel@alsa-project.org
> ---
>   sound/core/pcm_native.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai Sept. 21, 2023, 1:14 p.m. UTC | #2
On Thu, 21 Sep 2023 00:22:21 +0200,
David Howells wrote:
> 
> Fix snd_pcm_readv()/writev() to use iov access functions rather than poking
> at the iov_iter internals directly.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jaroslav Kysela <perex@perex.cz>
> cc: Takashi Iwai <tiwai@suse.com>
> cc: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> cc: Jens Axboe <axboe@kernel.dk>
> cc: Suren Baghdasaryan <surenb@google.com>
> cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> cc: alsa-devel@alsa-project.org

Reviewed-by: Takashi Iwai <tiwai@suse.de>

Would you apply it through your tree, or shall I apply this one via
sound git tree?


thanks,

Takashi

> ---
>  sound/core/pcm_native.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index bd9ddf412b46..9a69236fa207 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -3527,7 +3527,7 @@ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)
>  	if (runtime->state == SNDRV_PCM_STATE_OPEN ||
>  	    runtime->state == SNDRV_PCM_STATE_DISCONNECTED)
>  		return -EBADFD;
> -	if (!to->user_backed)
> +	if (!user_backed_iter(to))
>  		return -EINVAL;
>  	if (to->nr_segs > 1024 || to->nr_segs != runtime->channels)
>  		return -EINVAL;
> @@ -3567,7 +3567,7 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)
>  	if (runtime->state == SNDRV_PCM_STATE_OPEN ||
>  	    runtime->state == SNDRV_PCM_STATE_DISCONNECTED)
>  		return -EBADFD;
> -	if (!from->user_backed)
> +	if (!user_backed_iter(from))
>  		return -EINVAL;
>  	if (from->nr_segs > 128 || from->nr_segs != runtime->channels ||
>  	    !frame_aligned(runtime, iov->iov_len))
>
David Howells Sept. 21, 2023, 3:03 p.m. UTC | #3
Takashi Iwai <tiwai@suse.de> wrote:

> Would you apply it through your tree, or shall I apply this one via
> sound git tree?

It's a prerequisite for a later patch in this series, so I'd prefer to keep it
with my other patches.

David
Takashi Iwai Sept. 21, 2023, 3:10 p.m. UTC | #4
On Thu, 21 Sep 2023 17:03:28 +0200,
David Howells wrote:
> 
> Takashi Iwai <tiwai@suse.de> wrote:
> 
> > Would you apply it through your tree, or shall I apply this one via
> > sound git tree?
> 
> It's a prerequisite for a later patch in this series, so I'd prefer to keep it
> with my other patches.

Sure, please go ahead.


thanks,

Takashi
diff mbox series

Patch

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index bd9ddf412b46..9a69236fa207 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3527,7 +3527,7 @@  static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)
 	if (runtime->state == SNDRV_PCM_STATE_OPEN ||
 	    runtime->state == SNDRV_PCM_STATE_DISCONNECTED)
 		return -EBADFD;
-	if (!to->user_backed)
+	if (!user_backed_iter(to))
 		return -EINVAL;
 	if (to->nr_segs > 1024 || to->nr_segs != runtime->channels)
 		return -EINVAL;
@@ -3567,7 +3567,7 @@  static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)
 	if (runtime->state == SNDRV_PCM_STATE_OPEN ||
 	    runtime->state == SNDRV_PCM_STATE_DISCONNECTED)
 		return -EBADFD;
-	if (!from->user_backed)
+	if (!user_backed_iter(from))
 		return -EINVAL;
 	if (from->nr_segs > 128 || from->nr_segs != runtime->channels ||
 	    !frame_aligned(runtime, iov->iov_len))