Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3694852ybv; Mon, 10 Feb 2020 04:51:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxzLiznyYBLesYqC82WVRJg1O/G1QJ54Tuk05XHytEd7UWIPxzVU53Ktl6PEXImPTZXZYgZ X-Received: by 2002:aca:b4c3:: with SMTP id d186mr676099oif.131.1581339119630; Mon, 10 Feb 2020 04:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339119; cv=none; d=google.com; s=arc-20160816; b=ZPKjV2PZqjKVdpLmDIYhfXuavp7BPUiUQExbyppePPts34Cu9sPb6zDCZ2jWnMmHmn rAlgUHg1r2/IOhljVsZO4QqNjUCUaf+R9ojMtTkOja6ImoQHbk2ThAK91w1n60puRLDB chl2lrT6nmCBmEZbnmmZq+vPD4YSbN8juYGMNyzYVobTMxaLbz0Q+lC1ACprV+d3ylzM l4OM5EYBwnVR1Fu4eVVvyJ49S4Fc8p8NfMFmixd0rMoIrniVhvrq28K3KInUlIR+OC1n sHS9OzvXiWTnj9rKdD5RXZ8CZK18GyDk9RJ3tDj/G1i1WVBifmLOhnIb6peTJO/5RROa WpnQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z2Rw+NRqronloFGgqlTm2r7R1hkq9U8ctc0whKaFLmQ=; b=NIsO0fTHqKF1eH+2vN+jzMR+x6O30pozULugvO6FFUHGFD2OFwDWek5QIXQOy25+KY iK6mopfvP8APANn/j5VIPyu1GRZnef4DUAHSpkYuieGdxd5jCWMLVtetXcUr8sA1CZWG ZeaCLzNybnmdz0yDOs7ZlTjzGAyURicc2y3X6FgeaVWu1a/yvp/57UXu/k6fsTsqVbOY Gh2iAE0KTgzp4ZEJtM2iIu6CecnXKILarMzEKZVoGlPrsNiAlJL/UPij7BWe7sX7ijJh J9mw5AnZts/vd/iLcTgc3M0nCRfCO1uohfnLEOtm8A8GZhBvCU84nWtCZBtdKTi/fgKs ldrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TbaW2vB2; 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 p7si106955ota.299.2020.02.10.04.51.48; Mon, 10 Feb 2020 04:51:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b=TbaW2vB2; 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 S1730421AbgBJMnW (ORCPT + 99 others); Mon, 10 Feb 2020 07:43:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:38594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728958AbgBJMjw (ORCPT ); Mon, 10 Feb 2020 07:39:52 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 123B62467A; Mon, 10 Feb 2020 12:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338390; bh=c18dsmejcPXvDGKtlQTp7E0bFEvu+bOeNIWByPWdY5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TbaW2vB2lwiMbt4Ce2tQz88zt9fFKHj8ohesrcqYdC1XeftaZDbZ0HpH4/Wsq98hd LWc+tCSks0OU4ecguK0UYEukHdgKelhfqGy8ln30RbmgndEVVWUn9erjqHmMvGExc2 VZSYh8KVRO8A3UeyHhREHhntxftgcA4c9H38gX5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Bogendoerfer , Paul Burton , Ralf Baechle , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH 5.5 080/367] MIPS: SGI-IP30: Check for valid pointer before using it Date: Mon, 10 Feb 2020 04:29:53 -0800 Message-Id: <20200210122431.680229459@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Bogendoerfer commit c0e79fd89749b0cda1c72049e2772dd2eeada86f upstream. 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 Signed-off-by: Paul Burton Cc: Ralf Baechle Cc: James Hogan Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: # v5.5+ Signed-off-by: Greg Kroah-Hartman --- arch/mips/sgi-ip30/ip30-irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/arch/mips/sgi-ip30/ip30-irq.c +++ b/arch/mips/sgi-ip30/ip30-irq.c @@ -232,9 +232,10 @@ static void heart_domain_free(struct irq 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 = {