qcrypto: protect potential integer overflow.

Adding user passed parameters without check might
lead to Integer overflow and unpredictable system
behaviour.

Change-Id: Iaf8259e3c4a157e1790f1447b1b62a646988b7c4
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
Zhen Kong 2016-11-28 18:23:33 +05:30
parent 314869eb56
commit 34e32863a1

View file

@ -4967,6 +4967,11 @@ int qce_aead_req(void *handle, struct qce_req *q_req)
else
q_req->cryptlen = areq->cryptlen - authsize;
if (q_req->cryptlen > UINT_MAX - areq->assoclen) {
pr_err("Integer overflow on total aead req length.\n");
return -EINVAL;
}
totallen = q_req->cryptlen + areq->assoclen;
if (pce_dev->support_cmd_dscr) {