Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 501d0efe authored by Naman Jain's avatar Naman Jain Committed by Kishor Krishna Bhat
Browse files

haven: hh_rm_iface: Avoid integer overflow for multiplication



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

Change-Id: I28ea55c760257775c1bec3fdfb373fe075190cab
Signed-off-by: default avatarNaman Jain <quic_namajain@quicinc.com>
Signed-off-by: default avatarKishor Krishna Bhat <quic_kishkris@quicinc.com>
parent d6a2023c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ hh_rm_vm_get_hyp_res(hh_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) +