All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org,
	Hardik T Shah <hardik.t.shah@intel.com>,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jeeja KP <jeeja.kp@intel.com>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: Re: [patch] ASoC: Intel: Skylake: pointer math issue
Date: Wed, 09 Dec 2015 16:14:13 +0000	[thread overview]
Message-ID: <20151209160213.GE1854@localhost> (raw)
In-Reply-To: <20151208055321.GA5597@mwanda>

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

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org,
	Hardik T Shah <hardik.t.shah@intel.com>,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jeeja KP <jeeja.kp@intel.com>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: Re: [patch] ASoC: Intel: Skylake: pointer math issue
Date: Wed, 9 Dec 2015 21:32:13 +0530	[thread overview]
Message-ID: <20151209160213.GE1854@localhost> (raw)
In-Reply-To: <20151208055321.GA5597@mwanda>

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

  reply	other threads:[~2015-12-09 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151209160213.GE1854@localhost \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=hardik.t.shah@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.