diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2020-08-26 13:16:29 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2020-09-16 16:52:25 +0200 |
commit | 23357b61f8062a8a8c9c84c0252056cd6d849ec8 (patch) | |
tree | 4bc4088dd1be196148ebd01930734af19cede695 /drivers/iommu/amd | |
parent | 856deb866d16e29bd65952e0289066f6078af773 (diff) |
iommu/amd: Prevent NULL pointer dereference
Dereferencing irq_data before checking it for NULL is suboptimal.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd')
-rw-r--r-- | drivers/iommu/amd/iommu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 07ae8b93887e..db44ce67b979 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3731,8 +3731,8 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, for (i = 0; i < nr_irqs; i++) { irq_data = irq_domain_get_irq_data(domain, virq + i); - cfg = irqd_cfg(irq_data); - if (!irq_data || !cfg) { + cfg = irq_data ? irqd_cfg(irq_data) : NULL; + if (!cfg) { ret = -EINVAL; goto out_free_data; } |