mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
|
From 8f8066581a8e575a7d57d27f36c4db63f91ca48f Mon Sep 17 00:00:00 2001
|
||
|
From: Zhen Kong <zkong@codeaurora.org>
|
||
|
Date: Mon, 24 Oct 2016 13:52:04 -0700
|
||
|
Subject: msm: crypto: Fix integer over flow check in qce driver
|
||
|
|
||
|
Integer overflow check is invalid when ULONG_MAX is used,
|
||
|
as ULONG_MAX has typeof 'unsigned long', while areq->assoclen,
|
||
|
q_req->crytlen, and qreq.ivsize are 'unsigned int'. Make change
|
||
|
to use UINT_MAX instead of ULONG_MAX.
|
||
|
|
||
|
Change-Id: If2bb1900c07af1ea162da362c913d4880b0bc755
|
||
|
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
|
||
|
---
|
||
|
drivers/crypto/msm/qce.c | 6 +++---
|
||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/crypto/msm/qce.c b/drivers/crypto/msm/qce.c
|
||
|
index 7ddbb19..4cf95b9 100644
|
||
|
--- a/drivers/crypto/msm/qce.c
|
||
|
+++ b/drivers/crypto/msm/qce.c
|
||
|
@@ -1,6 +1,6 @@
|
||
|
/* Qualcomm Crypto Engine driver.
|
||
|
*
|
||
|
- * Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
|
||
|
+ * Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License version 2 and
|
||
|
@@ -1962,8 +1962,8 @@ int qce_aead_req(void *handle, struct qce_req *q_req)
|
||
|
else
|
||
|
q_req->cryptlen = areq->cryptlen - authsize;
|
||
|
|
||
|
- if ((q_req->cryptlen > ULONG_MAX - ivsize) ||
|
||
|
- (q_req->cryptlen + ivsize > ULONG_MAX - areq->assoclen)) {
|
||
|
+ if ((q_req->cryptlen > UINT_MAX - ivsize) ||
|
||
|
+ (q_req->cryptlen + ivsize > UINT_MAX - areq->assoclen)) {
|
||
|
pr_err("Integer overflow on total aead req length.\n");
|
||
|
return -EINVAL;
|
||
|
}
|
||
|
--
|
||
|
cgit v1.1
|
||
|
|