Skip to content

Commit

Permalink
MIPS: SGI-IP30: Check for valid pointer before using it
Browse files Browse the repository at this point in the history
Fix issue detected by Smatch:

    ./arch/mips/sgi-ip30/ip30-irq.c:236 heart_domain_free()
     warn: variable dereferenced before check 'irqd' (see line 235)

Fixes: 7505576 ("MIPS: add support for SGI Octane (IP30)")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: <stable@vger.kernel.org> # v5.5+
  • Loading branch information
Thomas Bogendoerfer authored and paulburton committed Jan 22, 2020
1 parent 4f29ad2 commit c0e79fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/mips/sgi-ip30/ip30-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ static void heart_domain_free(struct irq_domain *domain,
return;

irqd = irq_domain_get_irq_data(domain, virq);
clear_bit(irqd->hwirq, heart_irq_map);
if (irqd && irqd->chip_data)
if (irqd) {
clear_bit(irqd->hwirq, heart_irq_map);
kfree(irqd->chip_data);
}
}

static const struct irq_domain_ops heart_domain_ops = {
Expand Down

0 comments on commit c0e79fd

Please sign in to comment.