[alsa-devel] [PATCH 2/2] ALSA: pcm: implement the mmap buffer mode for the anonymous dup

Takashi Iwai tiwai at suse.de
Mon Feb 4 11:48:21 CET 2019


On Mon, 04 Feb 2019 10:39:10 +0100,
Jaroslav Kysela wrote:
> 
> @@ -3295,6 +3311,9 @@ static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file
>  			       struct vm_area_struct *area)
>  {
>  	long size;
> +	struct snd_pcm_file *pcm_file = file->private_data;
> +	if (pcm_file->perm != SNDRV_PCM_PERM_MODE_FULL)
> +		return -EPERM;

This check can be better put to pcm_status_mmap_allowed().

> @@ -3331,6 +3350,9 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
>  				struct vm_area_struct *area)
>  {
>  	long size;
> +	struct snd_pcm_file *pcm_file = file->private_data;
> +	if (pcm_file->perm != SNDRV_PCM_PERM_MODE_FULL)
> +		return -EPERM;

Ditto, put to pcm_control_mmap_allowed().

Other than that, looks good to me:
  Reviewed-by: Takashi Iwai <tiwai at suse.de>


thanks,

Takashi


More information about the Alsa-devel mailing list