From a9d64bf14eaf719818b6c58e626e6dc7e9f50e74 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Thu, 22 Oct 2020 11:11:22 -0700 Subject: [PATCH] SOF: ABI: fix implicit type overflow Implicit may values have a length of 15bits (s16) so we need to declare the proper size so we don't get undefined behaviour. The 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 --- 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 2251f667f2b115..5f0a21d87e5a29 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 */