Skip to content

Commit e0ccc4b

Browse files
committed
SOF: ABI: fix implicit type overflow
Implicit values have a length of 15bits (s16) so we need to declare the proper size so we don't get undefined behaviour. Ubsan discovered this bug in the firmware. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
1 parent eb9bb48 commit e0ccc4b

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)