From: Curtis Malainey Date: Fri, 20 Nov 2020 14:40:25 +0000 (+0200) Subject: ASoC: SOF: IPC: fix implicit type overflow X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7c1d0e554a359cca77bfabd2a29b06f5322d172d;p=linux.git 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 Reviewed-by: Guennadi Liakhovetski Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20201120144025.2166023-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h index 2d35997ace404..571e1dd54b894 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 */