All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()
@ 2014-04-13 17:56 ` Christian Engelmayer
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Engelmayer @ 2014-04-13 17:56 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Dan Carpenter,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

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(-)

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;
 }
-- 
1.8.3.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()
@ 2014-04-13 17:56 ` Christian Engelmayer
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Engelmayer @ 2014-04-13 17:56 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Mark Brown, Dan Carpenter


[-- Attachment #1.1: Type: text/plain, Size: 911 bytes --]

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(-)

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;
 }
-- 
1.8.3.2

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()
  2014-04-13 17:56 ` Christian Engelmayer
  (?)
@ 2014-04-15 11:13 ` Mark Brown
  -1 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2014-04-15 11:13 UTC (permalink / raw)
  To: Christian Engelmayer
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Dan Carpenter,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()
  2014-04-13 17:56 ` Christian Engelmayer
@ 2014-04-16 15:33   ` Dan Carpenter
  -1 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2014-04-16 15:33 UTC (permalink / raw)
  To: Christian Engelmayer
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

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


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

* Re: [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume()
@ 2014-04-16 15:33   ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2014-04-16 15:33 UTC (permalink / raw)
  To: Christian Engelmayer
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Liam Girdwood, Mark Brown

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

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

* [patch] ASoC: Intel: some incorrect sizeof() usages
  2014-04-13 17:56 ` Christian Engelmayer
@ 2014-04-16 15:38   ` Dan Carpenter
  -1 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2014-04-16 15:38 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	Christian Engelmayer, kernel-janitors

The intent was to say "sizeof(*pos)" and not "sizeof(pos)".

The sizeof(*pos) is 8 bytes so the bug won't show up on 64 bit systems.
The sizeof(*dx) is 172 bytes so that will be a bugfix.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  Not tested.

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index f46bb4d..4ed2d17 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -617,7 +617,7 @@ static void hsw_notification_work(struct work_struct *work)
 	case IPC_POSITION_CHANGED:
 		trace_ipc_notification("DSP stream position changed for",
 			stream->reply.stream_hw_id);
-		sst_dsp_inbox_read(hsw->dsp, pos, sizeof(pos));
+		sst_dsp_inbox_read(hsw->dsp, pos, sizeof(*pos));
 
 		if (stream->notify_position)
 			stream->notify_position(stream, stream->pdata);
@@ -1609,7 +1609,7 @@ int sst_hsw_dx_set_state(struct sst_hsw *hsw,
 	trace_ipc_request("PM enter Dx state", state);
 
 	ret = ipc_tx_message_wait(hsw, header, &state_, sizeof(state_),
-		dx, sizeof(dx));
+		dx, sizeof(*dx));
 	if (ret < 0) {
 		dev_err(hsw->dev, "ipc: error set dx state %d failed\n", state);
 		return ret;

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

* [patch] ASoC: Intel: some incorrect sizeof() usages
@ 2014-04-16 15:38   ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2014-04-16 15:38 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	Christian Engelmayer, kernel-janitors

The intent was to say "sizeof(*pos)" and not "sizeof(pos)".

The sizeof(*pos) is 8 bytes so the bug won't show up on 64 bit systems.
The sizeof(*dx) is 172 bytes so that will be a bugfix.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  Not tested.

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index f46bb4d..4ed2d17 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -617,7 +617,7 @@ static void hsw_notification_work(struct work_struct *work)
 	case IPC_POSITION_CHANGED:
 		trace_ipc_notification("DSP stream position changed for",
 			stream->reply.stream_hw_id);
-		sst_dsp_inbox_read(hsw->dsp, pos, sizeof(pos));
+		sst_dsp_inbox_read(hsw->dsp, pos, sizeof(*pos));
 
 		if (stream->notify_position)
 			stream->notify_position(stream, stream->pdata);
@@ -1609,7 +1609,7 @@ int sst_hsw_dx_set_state(struct sst_hsw *hsw,
 	trace_ipc_request("PM enter Dx state", state);
 
 	ret = ipc_tx_message_wait(hsw, header, &state_, sizeof(state_),
-		dx, sizeof(dx));
+		dx, sizeof(*dx));
 	if (ret < 0) {
 		dev_err(hsw->dev, "ipc: error set dx state %d failed\n", state);
 		return ret;

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

* Re: [patch] ASoC: Intel: some incorrect sizeof() usages
  2014-04-16 15:38   ` Dan Carpenter
@ 2014-04-18 16:11     ` Mark Brown
  -1 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2014-04-18 16:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	Christian Engelmayer, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Wed, Apr 16, 2014 at 06:38:11PM +0300, Dan Carpenter wrote:
> The intent was to say "sizeof(*pos)" and not "sizeof(pos)".
> 
> The sizeof(*pos) is 8 bytes so the bug won't show up on 64 bit systems.
> The sizeof(*dx) is 172 bytes so that will be a bugfix.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] ASoC: Intel: some incorrect sizeof() usages
@ 2014-04-18 16:11     ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2014-04-18 16:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	Christian Engelmayer, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Wed, Apr 16, 2014 at 06:38:11PM +0300, Dan Carpenter wrote:
> The intent was to say "sizeof(*pos)" and not "sizeof(pos)".
> 
> The sizeof(*pos) is 8 bytes so the bug won't show up on 64 bit systems.
> The sizeof(*dx) is 172 bytes so that will be a bugfix.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-04-18 16:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-13 17:56 [PATCH] ASoC: Intel: Fix incorrect sizeof() in sst_hsw_stream_get_volume() Christian Engelmayer
2014-04-13 17:56 ` Christian Engelmayer
2014-04-15 11:13 ` Mark Brown
2014-04-16 15:33 ` Dan Carpenter
2014-04-16 15:33   ` Dan Carpenter
2014-04-16 15:38 ` [patch] ASoC: Intel: some incorrect sizeof() usages Dan Carpenter
2014-04-16 15:38   ` Dan Carpenter
2014-04-18 16:11   ` Mark Brown
2014-04-18 16:11     ` 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.