Skip to contentSkip to conversation

iommu/vt-d: returning free pointer in get_domain_for_dev()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: returning free pointer in get_domain_for_dev()

If we hit this error condition then we want to return a NULL pointer and not a freed variable.

drivers/iommu/intel-iommu.c +1 -0
index 6fbce01..69fa7da 100644
@@ -2257,6 +2257,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
 		goto error;
 	if (iommu_attach_domain(domain, iommu)) {
 		free_domain_mem(domain);
+		domain = NULL;
 		goto error;
 	}
 	free = domain;
#1 lore raw
Quoted 10 lines · Dan Carpenter

If we hit this error condition then we want to return a NULL pointer and not a freed variable.

drivers/iommu/intel-iommu.c +0 -0
index 6fbce01..69fa7da 100644

drivers/iommu/intel-iommu.c static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) · line 2263

Quoted 7 lines
drivers/iommu/intel-iommu.c +1 -0
@@ -2257,6 +2257,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
 		goto error;
 	if (iommu_attach_domain(domain, iommu)) {
 		free_domain_mem(domain);
+		domain = NULL;
 		goto error;
 	}
 	free = domain;

Applied; thanks.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation