linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: SGI-IP30: Check for valid pointer before using it
@ 2020-01-22 13:13 Thomas Bogendoerfer
  2020-01-23 19:44 ` Paul Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Bogendoerfer @ 2020-01-22 13:13 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel

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: 7505576d1c1a ("MIPS: add support for SGI Octane (IP30)")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 arch/mips/sgi-ip30/ip30-irq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
index d45865c7644c..11cd2a888de5 100644
--- a/arch/mips/sgi-ip30/ip30-irq.c
+++ b/arch/mips/sgi-ip30/ip30-irq.c
@@ -245,9 +245,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 = {
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: SGI-IP30: Check for valid pointer before using it
  2020-01-22 13:13 [PATCH] MIPS: SGI-IP30: Check for valid pointer before using it Thomas Bogendoerfer
@ 2020-01-23 19:44 ` Paul Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2020-01-23 19:44 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel,
	linux-mips

Hello,

Thomas Bogendoerfer wrote:
> 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)

Applied to mips-next.

> commit c0e79fd89749
> https://git.kernel.org/mips/c/c0e79fd89749
> 
> Fixes: 7505576d1c1a ("MIPS: add support for SGI Octane (IP30)")
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> Signed-off-by: Paul Burton <paulburton@kernel.org>

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paulburton@kernel.org to report it. ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-23 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 13:13 [PATCH] MIPS: SGI-IP30: Check for valid pointer before using it Thomas Bogendoerfer
2020-01-23 19:44 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).