Skip to content

Commit 6cd9f6a

Browse files
cujomalaineylgirdwood
authored andcommitted
abi: fix macro size overflow
ubsan found the following bug via oss-fuzz /src/sof/src/ipc/handler.c:1385:9: runtime error: left shift of 15 by 28 places cannot be represented in type 'int' This is caused by SOF_GLB_TYPE_MASK which has an implicit length of 15 (int16_t) Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
1 parent ed21921 commit 6cd9f6a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/include/ipc/header.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154

155155
/** Shift-left bits to extract the global cmd type */
156156
#define SOF_GLB_TYPE_SHIFT 28
157-
#define SOF_GLB_TYPE_MASK (0xf << SOF_GLB_TYPE_SHIFT)
157+
#define SOF_GLB_TYPE_MASK (0xfL << SOF_GLB_TYPE_SHIFT)
158158
#define SOF_GLB_TYPE(x) ((x) << SOF_GLB_TYPE_SHIFT)
159159

160160
/** @} */
@@ -165,7 +165,7 @@
165165

166166
/** Shift-left bits to extract the command type */
167167
#define SOF_CMD_TYPE_SHIFT 16
168-
#define SOF_CMD_TYPE_MASK (0xfff << SOF_CMD_TYPE_SHIFT)
168+
#define SOF_CMD_TYPE_MASK (0xfffL << SOF_CMD_TYPE_SHIFT)
169169
#define SOF_CMD_TYPE(x) ((x) << SOF_CMD_TYPE_SHIFT)
170170

171171
/** @} */

src/include/kernel/abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/** \brief SOF ABI version major, minor and patch numbers */
3131
#define SOF_ABI_MAJOR 3
3232
#define SOF_ABI_MINOR 18
33-
#define SOF_ABI_PATCH 0
33+
#define SOF_ABI_PATCH 1
3434

3535
/** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */
3636
#define SOF_ABI_MAJOR_SHIFT 24

0 commit comments

Comments
 (0)