[alsa-devel] [PATCH v5 03/14] ASoC: SOF: Add driver debug support.

Takashi Iwai tiwai at suse.de
Fri Mar 29 17:04:46 CET 2019


On Thu, 21 Mar 2019 17:10:05 +0100,
Pierre-Louis Bossart wrote:
> 
> +static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,
> +				 size_t count, loff_t *ppos)
> +{
> +	struct snd_sof_dfsentry *dfse = file->private_data;
> +	struct snd_sof_dev *sdev = dfse->sdev;
> +	int size;
> +	u32 *buf;
> +	loff_t pos = *ppos;
> +	size_t size_ret;
> +
> +	size = dfse->size;
> +
> +	/* validate position & count */
> +	if (pos < 0)
> +		return -EINVAL;
> +	if (pos >= size || !count)
> +		return 0;
> +	/* find the minimum. min() is not used since it adds sparse warnings */
> +	if (count > size - pos)
> +		count = size - pos;
> +
> +	/* intermediate buffer size must be u32 multiple */
> +	size = ALIGN(count, 4);

Doesn't pos need to be aligned to 32bit as well (at least at actually
reading from iomem)?


thanks,

Takashi


More information about the Alsa-devel mailing list