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>
This commit is contained in:
Thomas Gleixner 2020-08-26 13:16:29 +02:00
parent 856deb866d
commit 23357b61f8

View File

@ -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;
}