Skip to content

Commit 7c1d0e5

Browse files
cujomalaineybroonie
authored andcommitted
ASoC: SOF: IPC: fix implicit type overflow
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> Link: https://lore.kernel.org/r/20201120144025.2166023-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6b114d8 commit 7c1d0e5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎include/sound/sof/header.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131

3232
/* Global Message - Generic */
3333
#define SOF_GLB_TYPE_SHIFT 28
34-
#define SOF_GLB_TYPE_MASK (0xf << SOF_GLB_TYPE_SHIFT)
34+
#define SOF_GLB_TYPE_MASK (0xfL << SOF_GLB_TYPE_SHIFT)
3535
#define SOF_GLB_TYPE(x) ((x) << SOF_GLB_TYPE_SHIFT)
3636

3737
/* Command Message - Generic */
3838
#define SOF_CMD_TYPE_SHIFT 16
39-
#define SOF_CMD_TYPE_MASK (0xfff << SOF_CMD_TYPE_SHIFT)
39+
#define SOF_CMD_TYPE_MASK (0xfffL << SOF_CMD_TYPE_SHIFT)
4040
#define SOF_CMD_TYPE(x) ((x) << SOF_CMD_TYPE_SHIFT)
4141

4242
/* Global Message Types */

0 commit comments

Comments
 (0)