* [PATCH] ASoC: Intel: Skylake: fix typo in sizeof
@ 2015-10-29 22:04 Vincent Stehlé
2015-10-30 3:02 ` Applied "ASoC: Intel: Skylake: fix typo in sizeof" to the asoc tree Mark Brown
2015-10-30 3:02 ` [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Vincent Stehlé @ 2015-10-29 22:04 UTC (permalink / raw)
To: alsa-devel
Cc: trivial, Vinod Koul, linux-kernel, Vincent Stehlé,
Mark Brown, Jeeja KP, Subhransu S . Prusty
The size of the pointer to a data structure to send is erroneously
passed to sst_ipc_tx_message_wait() as its tx_bytes argument. It should
be given the size of the pointed skl_ipc_dxstate_info structure instead.
Coincidentally, both the pointer and the structure have the same size of
8 bytes on a 64 bit machine, which "masks" the issue. Compiling for 32
bit reveals the issue more clearly.
Fix the typo for correctness, and to make the code robust to future
evolutions of the skl_ipc_dxstate_info structure size.
This fixes the following coccicheck error:
sound/soc/intel/skylake/skl-sst-ipc.c:641:8-14: ERROR: application of sizeof to pointer
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: trivial@kernel.org
---
sound/soc/intel/skylake/skl-sst-ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 937a0a3..9aee835 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -638,7 +638,7 @@ int skl_ipc_set_dx(struct sst_generic_ipc *ipc, u8 instance_id,
dev_dbg(ipc->dev, "In %s primary =%x ext=%x\n", __func__,
header.primary, header.extension);
ret = sst_ipc_tx_message_wait(ipc, *ipc_header,
- dx, sizeof(dx), NULL, 0);
+ dx, sizeof(*dx), NULL, 0);
if (ret < 0) {
dev_err(ipc->dev, "ipc: set dx failed, err %d\n", ret);
return ret;
--
2.6.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Applied "ASoC: Intel: Skylake: fix typo in sizeof" to the asoc tree
2015-10-29 22:04 [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Vincent Stehlé
@ 2015-10-30 3:02 ` Mark Brown
2015-10-30 3:02 ` [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-10-30 3:02 UTC (permalink / raw)
To: Subhransu S. Prusty, Jeeja KP, Vinod Koul, Mark Brown, trivial; +Cc: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 2909 bytes --]
The patch
ASoC: Intel: Skylake: fix typo in sizeof
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 8552d9581f986426c0c15742d5f5757c82190d57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@laposte.net>
Date: Thu, 29 Oct 2015 23:04:41 +0100
Subject: [PATCH] ASoC: Intel: Skylake: fix typo in sizeof
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The size of the pointer to a data structure to send is erroneously
passed to sst_ipc_tx_message_wait() as its tx_bytes argument. It should
be given the size of the pointed skl_ipc_dxstate_info structure instead.
Coincidentally, both the pointer and the structure have the same size of
8 bytes on a 64 bit machine, which "masks" the issue. Compiling for 32
bit reveals the issue more clearly.
Fix the typo for correctness, and to make the code robust to future
evolutions of the skl_ipc_dxstate_info structure size.
This fixes the following coccicheck error:
sound/soc/intel/skylake/skl-sst-ipc.c:641:8-14: ERROR: application of sizeof to pointer
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: trivial@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/intel/skylake/skl-sst-ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 3345ea0..95679c0 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -650,7 +650,7 @@ int skl_ipc_set_dx(struct sst_generic_ipc *ipc, u8 instance_id,
dev_dbg(ipc->dev, "In %s primary =%x ext=%x\n", __func__,
header.primary, header.extension);
ret = sst_ipc_tx_message_wait(ipc, *ipc_header,
- dx, sizeof(dx), NULL, 0);
+ dx, sizeof(*dx), NULL, 0);
if (ret < 0) {
dev_err(ipc->dev, "ipc: set dx failed, err %d\n", ret);
return ret;
--
2.6.1
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: Intel: Skylake: fix typo in sizeof
2015-10-29 22:04 [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Vincent Stehlé
2015-10-30 3:02 ` Applied "ASoC: Intel: Skylake: fix typo in sizeof" to the asoc tree Mark Brown
@ 2015-10-30 3:02 ` Mark Brown
2015-10-30 11:36 ` Vinod Koul
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-10-30 3:02 UTC (permalink / raw)
To: Vincent Stehlé
Cc: alsa-devel, trivial, Vinod Koul, linux-kernel, Jeeja KP,
Subhransu S . Prusty
[-- Attachment #1.1: Type: text/plain, Size: 428 bytes --]
On Thu, Oct 29, 2015 at 11:04:41PM +0100, Vincent Stehlé wrote:
> The size of the pointer to a data structure to send is erroneously
> passed to sst_ipc_tx_message_wait() as its tx_bytes argument. It should
> be given the size of the pointed skl_ipc_dxstate_info structure instead.
This was reported by 0 day, please don't ignore reports from 0 day.
> Cc: trivial@kernel.org
This doesn't look like a trivial fix...
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: Intel: Skylake: fix typo in sizeof
2015-10-30 3:02 ` [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Mark Brown
@ 2015-10-30 11:36 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2015-10-30 11:36 UTC (permalink / raw)
To: Mark Brown
Cc: Vincent Stehlé, alsa-devel, linux-kernel,
Subhransu S . Prusty, Jeeja KP, trivial
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
On Fri, Oct 30, 2015 at 12:02:58PM +0900, Mark Brown wrote:
> On Thu, Oct 29, 2015 at 11:04:41PM +0100, Vincent Stehlé wrote:
> > The size of the pointer to a data structure to send is erroneously
> > passed to sst_ipc_tx_message_wait() as its tx_bytes argument. It should
> > be given the size of the pointed skl_ipc_dxstate_info structure instead.
>
> This was reported by 0 day, please don't ignore reports from 0 day.
I usually do keep track of any issues reported by 0day, must have missed
this one then. Will check if any other issue was reported..
I know one issue at least for which we have a patch, will send that out as
well
--
~Vinod
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-30 11:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 22:04 [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Vincent Stehlé
2015-10-30 3:02 ` Applied "ASoC: Intel: Skylake: fix typo in sizeof" to the asoc tree Mark Brown
2015-10-30 3:02 ` [PATCH] ASoC: Intel: Skylake: fix typo in sizeof Mark Brown
2015-10-30 11:36 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox