diff mbox

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

Message ID 1464785361-20038-1-git-send-email-jens.wiklander@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jens Wiklander June 1, 2016, 12:49 p.m. UTC
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@gmail.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 include/linux/arm-smccc.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Russell King (Oracle) June 1, 2016, 4:04 p.m. UTC | #1
On Wed, Jun 01, 2016 at 02:49:21PM +0200, Jens Wiklander wrote:
> 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@gmail.com>
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

Looks fine to me.  Who's merging this change?  If they're going some
other route:

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.
Jens Wiklander June 2, 2016, 8:28 a.m. UTC | #2
On Wed, Jun 1, 2016 at 6:04 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Wed, Jun 01, 2016 at 02:49:21PM +0200, Jens Wiklander wrote:
>> 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@gmail.com>
>> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
>
> Looks fine to me.  Who's merging this change?  If they're going some
> other route:
>
> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks, Russel. I was hoping you would take it when it's reviewed.

Thanks,
Jens
diff mbox

Patch

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