Commit 470047b5 authored by Naman Jain's avatar Naman Jain
Browse files

gunyah: gh_rm_iface: Avoid integer overflow for multiplication



Add a check to ensure that overflow does not happen in multiplication
operation.

Change-Id: I8b3be6acd92147543ab785c5762a1b2609e5a93d
Signed-off-by: default avatarNaman Jain <quic_namajain@quicinc.com>
parent 83069fca
......@@ -594,6 +594,8 @@ gh_rm_vm_get_hyp_res(gh_vmid_t vmid, u32 *n_entries)
/* The response payload should contain all the resource entries */
if (resp_payload_size < sizeof(*n_entries) ||
(sizeof(*resp_entries) &&
(resp_payload->n_resource_entries > U32_MAX / sizeof(*resp_entries))) ||
(sizeof(*n_entries) > (U32_MAX -
(resp_payload->n_resource_entries * sizeof(*resp_entries)))) ||
resp_payload_size != sizeof(*n_entries) +
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment