All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ASoC: Intel: Skylake: pointer math issue
@ 2015-12-08  5:53 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-12-08  5:53 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Vinod Koul, Jeeja KP,
	Subhransu S. Prusty, Hardik T Shah, alsa-devel, kernel-janitors

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

Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index dde8d3c..2c4405e 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -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;
 	}
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [patch] ASoC: Intel: Skylake: pointer math issue
@ 2015-12-08  5:53 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-12-08  5:53 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Vinod Koul, Jeeja KP,
	Subhransu S. Prusty, Hardik T Shah, alsa-devel, kernel-janitors

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

Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index dde8d3c..2c4405e 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -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;
 	}
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch] ASoC: Intel: Skylake: pointer math issue
  2015-12-08  5:53 ` Dan Carpenter
@ 2015-12-09 16:14   ` Vinod Koul
  -1 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2015-12-09 16:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: alsa-devel, Hardik T Shah, kernel-janitors, Takashi Iwai,
	Liam Girdwood, Mark Brown, Jeeja KP, Subhransu S. Prusty

On Tue, Dec 08, 2015 at 08:53:22AM +0300, Dan Carpenter wrote:
> "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

> 
> Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> index dde8d3c..2c4405e 100644
> --- a/sound/soc/intel/skylake/skl-topology.c
> +++ b/sound/soc/intel/skylake/skl-topology.c
> @@ -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;
>  	}
>  

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] ASoC: Intel: Skylake: pointer math issue
@ 2015-12-09 16:14   ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2015-12-09 16:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: alsa-devel, Hardik T Shah, kernel-janitors, Takashi Iwai,
	Liam Girdwood, Mark Brown, Jeeja KP, Subhransu S. Prusty

On Tue, Dec 08, 2015 at 08:53:22AM +0300, Dan Carpenter wrote:
> "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

> 
> Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> index dde8d3c..2c4405e 100644
> --- a/sound/soc/intel/skylake/skl-topology.c
> +++ b/sound/soc/intel/skylake/skl-topology.c
> @@ -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;
>  	}
>  

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] ASoC: Intel: Skylake: pointer math issue
  2015-12-09 16:14   ` Vinod Koul
@ 2015-12-16 14:53     ` Vinod Koul
  -1 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2015-12-16 14:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jeeja KP, Subhransu S. Prusty, Hardik T Shah, alsa-devel,
	kernel-janitors

On Wed, Dec 09, 2015 at 09:32:13PM +0530, Vinod Koul wrote:
> On Tue, Dec 08, 2015 at 08:53:22AM +0300, Dan Carpenter wrote:
> > "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

Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Dharageswari R <dharageswari.r@intel.com>


> > 
> > Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> > index dde8d3c..2c4405e 100644
> > --- a/sound/soc/intel/skylake/skl-topology.c
> > +++ b/sound/soc/intel/skylake/skl-topology.c
> > @@ -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;
> >  	}
> >  
> 
> -- 
> ~Vinod

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] ASoC: Intel: Skylake: pointer math issue
@ 2015-12-16 14:53     ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2015-12-16 14:53 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jeeja KP, Subhransu S. Prusty, Hardik T Shah, alsa-devel,
	kernel-janitors

On Wed, Dec 09, 2015 at 09:32:13PM +0530, Vinod Koul wrote:
> On Tue, Dec 08, 2015 at 08:53:22AM +0300, Dan Carpenter wrote:
> > "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

Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Dharageswari R <dharageswari.r@intel.com>


> > 
> > Fixes: 140adfba5280 ('ASoC: Intel: Skylake: Add tlv byte kcontrols')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> > index dde8d3c..2c4405e 100644
> > --- a/sound/soc/intel/skylake/skl-topology.c
> > +++ b/sound/soc/intel/skylake/skl-topology.c
> > @@ -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;
> >  	}
> >  
> 
> -- 
> ~Vinod

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Applied "ASoC: Intel: Skylake: pointer math issue" to the asoc tree
  2015-12-08  5:53 ` Dan Carpenter
  (?)
  (?)
@ 2015-12-16 19:24 ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2015-12-16 19:24 UTC (permalink / raw)
  To: Dan Carpenter, Vinod Koul, Dharageswari R, Mark Brown; +Cc: alsa-devel

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

>From e8bc3c99fa982f616e74aec4445945400a9c56f3 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index b824450edcb4..34f2f7351f66 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -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;
 	}
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-16 19:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08  5:53 [patch] ASoC: Intel: Skylake: pointer math issue Dan Carpenter
2015-12-08  5:53 ` Dan Carpenter
2015-12-09 16:02 ` Vinod Koul
2015-12-09 16:14   ` Vinod Koul
2015-12-16 14:41   ` Vinod Koul
2015-12-16 14:53     ` Vinod Koul
2015-12-16 19:24 ` Applied "ASoC: Intel: Skylake: pointer math issue" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.