From: Liu Yi L Date: Fri, 3 Jan 2020 13:28:05 +0000 (+0800) Subject: intel_iommu: a fix to vtd_find_as_from_bus_num() X-Git-Tag: qemu-xen-4.14.0~209^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a2e1cd41ccfe796529abfd1b6aeb1dd4393762a2;p=qemu-xen.git intel_iommu: a fix to vtd_find_as_from_bus_num() Ensure the return value of vtd_find_as_from_bus_num() is NULL by enforcing vtd_bus=NULL. This would help caller of vtd_find_as_from_bus_num() to decide if any further operation on the returned vtd_bus. Cc: qemu-stable@nongnu.org Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Yi Sun Signed-off-by: Liu Yi L Signed-off-by: Yi Sun Message-Id: <1578058086-4288-2-git-send-email-yi.l.liu@intel.com> Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index ee06993675..609b80750a 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -948,6 +948,7 @@ static VTDBus *vtd_find_as_from_bus_num(IntelIOMMUState *s, uint8_t bus_num) return vtd_bus; } } + vtd_bus = NULL; } return vtd_bus; }