ASoC: dmaengine: Fix missing __user prefix in copy_user callback
Subsystems (3)
PATCH 1/1 ASoC: dmaengine: Fix missing __user prefix in copy_user callback
It seems that __user prefix was forgotten to be added to dmaengine_copy_user callback while we refactored the user-copy PCM core.
This patch adds the missing prefix, remove the superfluous cast, and add the needed cast (__force is needed for downgrading from user pointer to kernel pointer), too.
Spotted by a sparse warning like:
sound/soc/soc-generic-dmaengine-pcm.c:397:27: warning: incorrect type in initializer (incompatible argument 4 (different address spaces))
--- sound/soc/soc-generic-dmaengine-pcm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/soc/soc-generic-dmaengine-pcm.c +4 -5
@@ -343,7 +343,7 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(static int dmaengine_copy_user (struct snd_pcm_substream *substream,int channel,unsigned long hwoff, -void *buf,unsigned long bytes) +void __user *buf,unsigned long bytes) {struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component =
@@ -359,18 +359,17 @@ static int dmaengine_copy_user(struct snd_pcm_substream *substream,int ret;if (is_playback) -if (copy_from_user (dma_ptr, (void __user *)buf, bytes)) +if (copy_from_user (dma_ptr, buf, bytes))return -EFAULT ;if (process) { - ret =process (substream, channel, hwoff, - (void __user *)buf, bytes); + ret =process (substream, channel, hwoff, (__force void *)buf, bytes);if (ret <0 )return ret; }if (!is_playback) -if (copy_to_user ((void __user *)buf, dma_ptr, bytes)) +if (copy_to_user (buf, dma_ptr, bytes))return -EFAULT ;return 0 ;
Signature · 1 line
2.18.0
Mark Brown
maintainerApplied "ASoC: dmaengine: Fix missing __user prefix in copy_user callback" to the asoc tree
The patch
ASoC: dmaengine: Fix missing __user prefix in copy_user callback
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
40d1299f87bf915931970c8e6ea3852acacd1889Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Wed, 25 Jul 2018 22:42:08 +0200
Subject: [PATCH] ASoC: dmaengine: Fix missing __user prefix in copy_user
callback
It seems that __user prefix was forgotten to be added to dmaengine_copy_user callback while we refactored the user-copy PCM core.
This patch adds the missing prefix, remove the superfluous cast, and add the needed cast (__force is needed for downgrading from user pointer to kernel pointer), too.
Spotted by a sparse warning like:
sound/soc/soc-generic-dmaengine-pcm.c:397:27: warning: incorrect type in initializer (incompatible argument 4 (different address spaces))
--- sound/soc/soc-generic-dmaengine-pcm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/soc/soc-generic-dmaengine-pcm.c +4 -5
@@ -334,7 +334,7 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(static int dmaengine_copy_user (struct snd_pcm_substream *substream,int channel,unsigned long hwoff, -void *buf,unsigned long bytes) +void __user *buf,unsigned long bytes) {struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component =
@@ -350,18 +350,17 @@ static int dmaengine_copy_user(struct snd_pcm_substream *substream,int ret;if (is_playback) -if (copy_from_user (dma_ptr, (void __user *)buf, bytes)) +if (copy_from_user (dma_ptr, buf, bytes))return -EFAULT ;if (process) { - ret =process (substream, channel, hwoff, - (void __user *)buf, bytes); + ret =process (substream, channel, hwoff, (__force void *)buf, bytes);if (ret <0 )return ret; }if (!is_playback) -if (copy_to_user ((void __user *)buf, dma_ptr, bytes)) +if (copy_to_user (buf, dma_ptr, bytes))return -EFAULT ;return 0 ;
Signature · 1 line
2.18.0