Skip to content

Commit bc918b7

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 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 bc918b7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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 */

include/uapi/sound/sof/abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/* SOF ABI version major, minor and patch numbers */
2828
#define SOF_ABI_MAJOR 3
2929
#define SOF_ABI_MINOR 17
30-
#define SOF_ABI_PATCH 0
30+
#define SOF_ABI_PATCH 1
3131

3232
/* SOF ABI version number. Format within 32bit word is MMmmmppp */
3333
#define SOF_ABI_MAJOR_SHIFT 24

0 commit comments

Comments
 (0)