All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: IPC: fix implicit type overflow
@ 2020-11-20 14:40 Kai Vehmanen
  2020-11-20 21:35 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Vehmanen @ 2020-11-20 14:40 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: Guennadi Liakhovetski, kai.vehmanen, lgirdwood,
	pierre-louis.bossart, ranjani.sridharan, Curtis Malainey,
	daniel.baluta

From: Curtis Malainey <cujomalainey@chromium.org>

Implicit values may have a length of 15bits (s16) so we need to declare
the proper size so we don't get undefined behaviour. This appears to be
arch and compiler dependent. This commit is to keep the headers aligned
between the firmware and kernel. UBSan discovered this bug in the
firmware.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 include/sound/sof/header.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h
index 2d35997ace40..571e1dd54b89 100644
--- a/include/sound/sof/header.h
+++ b/include/sound/sof/header.h
@@ -31,12 +31,12 @@
 
 /* Global Message - Generic */
 #define SOF_GLB_TYPE_SHIFT			28
-#define SOF_GLB_TYPE_MASK			(0xf << SOF_GLB_TYPE_SHIFT)
+#define SOF_GLB_TYPE_MASK			(0xfL << SOF_GLB_TYPE_SHIFT)
 #define SOF_GLB_TYPE(x)				((x) << SOF_GLB_TYPE_SHIFT)
 
 /* Command Message - Generic */
 #define SOF_CMD_TYPE_SHIFT			16
-#define SOF_CMD_TYPE_MASK			(0xfff << SOF_CMD_TYPE_SHIFT)
+#define SOF_CMD_TYPE_MASK			(0xfffL << SOF_CMD_TYPE_SHIFT)
 #define SOF_CMD_TYPE(x)				((x) << SOF_CMD_TYPE_SHIFT)
 
 /* Global Message Types */
-- 
2.28.0


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

* Re: [PATCH] ASoC: SOF: IPC: fix implicit type overflow
  2020-11-20 14:40 [PATCH] ASoC: SOF: IPC: fix implicit type overflow Kai Vehmanen
@ 2020-11-20 21:35 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-11-20 21:35 UTC (permalink / raw)
  To: Kai Vehmanen, alsa-devel
  Cc: Guennadi Liakhovetski, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, Curtis Malainey, daniel.baluta

On Fri, 20 Nov 2020 16:40:25 +0200, Kai Vehmanen wrote:
> Implicit values may have a length of 15bits (s16) so we need to declare
> the proper size so we don't get undefined behaviour. This appears to be
> arch and compiler dependent. This commit is to keep the headers aligned
> between the firmware and kernel. UBSan discovered this bug in the
> firmware.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: IPC: fix implicit type overflow
      commit: 7c1d0e554a359cca77bfabd2a29b06f5322d172d

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

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

end of thread, other threads:[~2020-11-20 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 14:40 [PATCH] ASoC: SOF: IPC: fix implicit type overflow Kai Vehmanen
2020-11-20 21:35 ` 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.