Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4813245ybl; Wed, 22 Jan 2020 05:15:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzxWf0SHl0RBAdbXr1WfgAoMdxhhx97TP8+LgEnaHrtHp+Q3RBpgDlVTb/p9thfJ8tCwoHP X-Received: by 2002:a05:6830:1482:: with SMTP id s2mr7560698otq.285.1579698943656; Wed, 22 Jan 2020 05:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579698943; cv=none; d=google.com; s=arc-20160816; b=RYPHCpqw5cmCspjdhVLMEMw+5W6LYKZIHGjuHTKc+q9Cz8gVqvnFyCjNtYqqOTSciZ x/jezZpjs03zj7lxuFENdL7hjget7e98txogWBSDXwI7IbhqDi4rasUuUBHOpob0X/xB Dueg7hJRQBAN4HrGmcVQQ2udJofF8WK8WY4xqp5H6Y7xhtfX5Ax40yRbOX4zmkkVqjhV WzkQG/YJZZdX3grqrZRtkYyjc7c1OmLd6Nx+Dc70revG+Cd/3INs5/hOWaEf5pwL4aS2 xadhkz6ODsNMPKP/SlgfGzmrIycVkUbDIF9tyGD/9VnjECLD9vL75UrpVVCwIrokFf34 +8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=m42y68yfzfProwONPK8RXz1OQJrUwxxM6xHaAEQG2JQ=; b=FtP34Bc6bedzqogRL2AOWZ+2BNG1P81mRz9JjIjwCPF8agKg/xorBvkpr8dMKaFnXY DfzBp7KlENcOXIm6fTeI2I8tQ/hFzkxXb0Nb47CBWnCPf5GLh+0ls0+22++OUuNaz20B tm3Zd98s3yPQgXyvlbtScTE9px64173bcvXU26rlR8J6/2Pea0i4I6EP5diUj8PPTYUu Um9TCwHM5BsL/RC69cQJVdpVqR2yFSpm2TjL0BiBUgs5MhgwjzLMdH+n+ph/aQ/X2eFj U01JEaVyAmlkEwYclQYMhijffZ2ypCY3lXBFJi6ABqO764hhV8CyDylbHdP7GTh26Jtt 2nLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si15903885otn.123.2020.01.22.05.15.31; Wed, 22 Jan 2020 05:15:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729232AbgAVNNt (ORCPT + 99 others); Wed, 22 Jan 2020 08:13:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:34520 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726204AbgAVNNs (ORCPT ); Wed, 22 Jan 2020 08:13:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CEC1AB066; Wed, 22 Jan 2020 13:13:46 +0000 (UTC) From: Thomas Bogendoerfer To: Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: SGI-IP30: Check for valid pointer before using it Date: Wed, 22 Jan 2020 14:13:34 +0100 Message-Id: <20200122131334.21970-1-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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