diff mbox

ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()

Message ID 20140413195636.32f31cb2@spike (mailing list archive)
State Accepted
Commit f3046f86b8a455ae55b8d465cd34938006361096
Headers show

Commit Message

Christian Engelmayer April 13, 2014, 5:56 p.m. UTC
Fix an incorrect sizeof() usage in sst_hsw_stream_get_volume(). sst_dsp_read()
is called to read into a variable of type u32, but is passed sizeof(u32 *) for
argument 'size_t bytes'. Detected by Coverity: CID 1195260.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
 sound/soc/intel/sst-haswell-ipc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mark Brown April 15, 2014, 11:13 a.m. UTC | #1
On Sun, Apr 13, 2014 at 07:56:36PM +0200, Christian Engelmayer wrote:
> Fix an incorrect sizeof() usage in sst_hsw_stream_get_volume(). sst_dsp_read()
> is called to read into a variable of type u32, but is passed sizeof(u32 *) for
> argument 'size_t bytes'. Detected by Coverity: CID 1195260.

Applied, thanks.
Dan Carpenter April 16, 2014, 3:33 p.m. UTC | #2
On Sun, Apr 13, 2014 at 07:56:36PM +0200, Christian Engelmayer wrote:
> Fix an incorrect sizeof() usage in sst_hsw_stream_get_volume(). sst_dsp_read()
> is called to read into a variable of type u32, but is passed sizeof(u32 *) for
> argument 'size_t bytes'. Detected by Coverity: CID 1195260.
> 
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>

There are a couple others in this file.  I introduced one of them.  :(
Sorry about that.  I'll send a patch for that.

regards,
dan carpenter
diff mbox

Patch

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index f46bb4d..455a185 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -991,7 +991,8 @@  int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream
 		return -EINVAL;
 
 	sst_dsp_read(hsw->dsp, volume,
-		stream->reply.volume_register_address[channel], sizeof(volume));
+		stream->reply.volume_register_address[channel],
+		sizeof(*volume));
 
 	return 0;
 }