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: <e3ad122c-d560-33f6-1bff-ea2b16fe47b5@linux.intel.com>
Date:   Tue, 21 Jul 2020 14:54:41 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        broonie@...nel.org
Cc:     alsa-devel@...a-project.org, ckeepax@...nsource.cirrus.com,
        tiwai@...e.com, lgirdwood@...il.com, linux-kernel@...r.kernel.org,
        vkoul@...nel.org
Subject: Re: [PATCH v2 9/9] ASoC: q6asm-dai: add support to copy callback



> +static int q6asm_compr_copy(struct snd_soc_component *component,
> +			    struct snd_compr_stream *stream, char __user *buf,
> +			    size_t count)
>   {
>   	struct snd_compr_runtime *runtime = stream->runtime;
>   	struct q6asm_dai_rtd *prtd = runtime->private_data;
>   	unsigned long flags;
> +	u32 wflags = 0;
> +	int avail, bytes_in_flight = 0;
> +	void *dstn;
> +	size_t copy;
> +	u32 app_pointer;
> +	u32 bytes_received;
> +
> +	bytes_received = prtd->bytes_received;
> +
> +	/**

/*

> +	 * Make sure that next track data pointer is aligned at 32 bit boundary
> +	 * This is a Mandatory requirement from DSP data buffers alignment
> +	 */
> +	if (prtd->next_track)
> +		bytes_received = ALIGN(prtd->bytes_received, prtd->pcm_count);
> +
> +	app_pointer = bytes_received/prtd->pcm_size;
> +	app_pointer = bytes_received -  (app_pointer * prtd->pcm_size);
> +	dstn = prtd->dma_buffer.area + app_pointer;
> +
> +	if (count < prtd->pcm_size - app_pointer) {
> +		if (copy_from_user(dstn, buf, count))
> +			return -EFAULT;
> +	} else {
> +		copy = prtd->pcm_size - app_pointer;
> +		if (copy_from_user(dstn, buf, copy))
> +			return -EFAULT;
> +		if (copy_from_user(prtd->dma_buffer.area, buf + copy,
> +				   count - copy))
> +			return -EFAULT;
> +	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ