Skip to contentSkip to conversation

ASoC: Intel: Skylake: pointer math issue

PATCH In review Dan Carpenter 3 participants 4 messages Dec 8, 2015 – Dec 16, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Intel: Skylake: pointer math issue

"data" is a u32 pointer so this copies the information to wrong place entirely.

Fixes 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
sound/soc/intel/skylake/skl-topology.c +2 -2
index dde8d3c..2c4405e 100644
@@ -885,9 +885,9 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol,
 	if (bc->params) {
 		if (copy_to_user(data, &bc->param_id, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + sizeof(u32), &size, sizeof(u32)))
+		if (copy_to_user(data + 1, &size, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + 2 * sizeof(u32), bc->params, size))
+		if (copy_to_user(data + 2, bc->params, size))
 			return -EFAULT;
 	}
 
#1 lore raw
Quoted 2 lines · Dan Carpenter

"data" is a u32 pointer so this copies the information to wrong place entirely.

Thanks this patch makes sense, I will test this tomorrow and get back

Quoted 20 lines
Fixes 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
sound/soc/intel/skylake/skl-topology.c +2 -2
index dde8d3c..2c4405e 100644
@@ -885,9 +885,9 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol,
 	if (bc->params) {
 		if (copy_to_user(data, &bc->param_id, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + sizeof(u32), &size, sizeof(u32)))
+		if (copy_to_user(data + 1, &size, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + 2 * sizeof(u32), bc->params, size))
+		if (copy_to_user(data + 2, bc->params, size))
 			return -EFAULT;
 	}
 
Signature · 1 line
~Vinod
Acked-by Tested-by Dharageswari R
#2 lore raw
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Dan Carpenter

"data" is a u32 pointer so this copies the information to wrong place entirely.

Thanks this patch makes sense, I will test this tomorrow and get back

Sorry this took a little while longer but this works

Quoted 23 lines
Quoted 20 lines
Fixes 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
sound/soc/intel/skylake/skl-topology.c +2 -2
index dde8d3c..2c4405e 100644
@@ -885,9 +885,9 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol,
 	if (bc->params) {
 		if (copy_to_user(data, &bc->param_id, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + sizeof(u32), &size, sizeof(u32)))
+		if (copy_to_user(data + 1, &size, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + 2 * sizeof(u32), bc->params, size))
+		if (copy_to_user(data + 2, bc->params, size))
 			return -EFAULT;
 	}
 
Signature · 1 line
~Vinod
Signature · 1 line
~Vinod
maintainer
#3 lore raw

Applied "ASoC: Intel: Skylake: pointer math issue" to the asoc tree

In reply to Dan Carpenter

The patch

ASoC: Intel: Skylake: pointer math issue

has been applied to the asoc tree at

git://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 e8bc3c99fa982f616e74aec4445945400a9c56f3 Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Tue, 8 Dec 2015 08:53:22 +0300
Subject: [PATCH] ASoC: Intel: Skylake: pointer math issue

"data" is a u32 pointer so this copies the information to wrong place entirely.

Fixes 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
---
 sound/soc/intel/skylake/skl-topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +2 -2
index b824450edcb4..34f2f7351f66 100644
@@ -919,9 +919,9 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol,
 	if (bc->params) {
 		if (copy_to_user(data, &bc->param_id, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + sizeof(u32), &size, sizeof(u32)))
+		if (copy_to_user(data + 1, &size, sizeof(u32)))
 			return -EFAULT;
-		if (copy_to_user(data + 2 * sizeof(u32), bc->params, size))
+		if (copy_to_user(data + 2, bc->params, size))
 			return -EFAULT;
 	}
 
Signature · 1 line
2.6.2