[PATCH] include/linux/arm-smccc.h: avoid sign extension problem

Jens Wiklander jens.wiklander at linaro.org
Wed Jun 1 05:49:21 PDT 2016


Prior to this patch the ARM_SMCCC_FAST_CALL constant was of a signed
type causing unwanted sign extension. This patch explicitly selects an
unsigned type for the constant.

Reported-by: Saksham Jain <sakjain92 at gmail.com>
Signed-off-by: Jens Wiklander <jens.wiklander at linaro.org>
---
 include/linux/arm-smccc.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index b5abfda..699c0d8 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -23,8 +23,9 @@
  * http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
  */
 
-#define ARM_SMCCC_STD_CALL		0
-#define ARM_SMCCC_FAST_CALL		1
+/* This constant is shifted by 31, make sure it's of an unsigned type */
+#define ARM_SMCCC_STD_CALL		0UL
+#define ARM_SMCCC_FAST_CALL		1UL
 #define ARM_SMCCC_TYPE_SHIFT		31
 
 #define ARM_SMCCC_SMC_32		0
-- 
1.9.1




More information about the linux-arm-kernel mailing list