[PATCH 1/2] x86: vtd: Do not overrun while counting IOMMU units

3 views
Skip to first unread message

Jan Kiszka

unread,
Jul 2, 2015, 3:53:32 AM7/2/15
to jailho...@googlegroups.com, Valentine Sinitsyn
Account for the case that we have JAILHOUSE_MAX_IOMMU_UNITS units, thus
no zeroed entry in platform_info.x86.iommu_base.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
hypervisor/arch/x86/vtd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c
index 8c95c2f..44474fb 100644
--- a/hypervisor/arch/x86/vtd.c
+++ b/hypervisor/arch/x86/vtd.c
@@ -482,7 +482,8 @@ int iommu_init(void)

int_remap_table_size_log2 = n;

- while (system_config->platform_info.x86.iommu_base[units])
+ while (units < JAILHOUSE_MAX_IOMMU_UNITS &&
+ system_config->platform_info.x86.iommu_base[units])
units++;
if (units == 0)
return trace_error(-EINVAL);
--
2.1.4

Reply all
Reply to author
Forward
0 new messages