Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp434235pxb; Thu, 21 Oct 2021 02:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwzHQ5CyPEOAOsgrwiVsoB3yzr9qB8NKW2v5GoPjwRaKLl5acJKTPTs6zf9b1Etztti2rv X-Received: by 2002:a17:906:6b0c:: with SMTP id q12mr6014686ejr.0.1634808492199; Thu, 21 Oct 2021 02:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634808492; cv=none; d=google.com; s=arc-20160816; b=XuXGsNcLC14QmWNmt2+KF/nlA3zKHLkhuUqBpZ0i5O/pFrn/Jrs1P63RpSCmZP08uv BVd4b84OXQ6EJAJiNHRyhKi+r6JgbEH7UF6esZOvs4yRN6+ACiQjzSVw2ZymkvtHGn+K /i0LDIBWLkSTKM3bi7i6LbOKHiZ7BUpl/L8hYi5Svp6WoPOVNCHoKR9v4WUD3cjZEXF+ PifBUaR7M676JombyEqSfurJKYFmL/dKBeAI9AEDUfkkA3cx38mA86g8HeBWUP5tIzKc dwo0giuIzZT+SWqyz1zbMkc5PDHDtrU1rznOHdFr4vmSN/liWPgyTN2HCD6Hw5KSfVlR Ly0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=AzzQxGqX0fQ9E2a1OEUVytn9/CW2FxOLCvVxsng3PyE=; b=vFLzodEodCvaY3qHUSsiXd2XellpFzJwgwqz9yCz99ATcI4eFCTe0kpzgyH/VmfZii CDJiM1i3yCHfJpzuwPiEwfan/n72i9XVlx0NZMj5KksT2J1l5/t4kP1BPQ0WfpEVNvNz cjdJFa5PAH6v1C8gfjN29ZqR2UOHDnc2Gup+h07rcdE0DXJm11NPVwoTvFZ8DChKM/Dy Cy7MKbZMUMEKal7qQDgIRkaV64vEGiGurMi2QUaAOlslGLSGwjhDHneA02s170jwTFsI eB3PX4TMzTfQ0HEflr8L8OeHwXCXYCtylzNTWec3wXBH0cYxRZbTKK/uMTfeeQs5HuZJ zH2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn8si1444829ejc.33.2021.10.21.02.27.45; Thu, 21 Oct 2021 02:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbhJUJZU (ORCPT + 99 others); Thu, 21 Oct 2021 05:25:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:39314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbhJUJZU (ORCPT ); Thu, 21 Oct 2021 05:25:20 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 6EC2460E96; Thu, 21 Oct 2021 09:23:04 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mdUHu-000f8R-Dd; Thu, 21 Oct 2021 10:23:02 +0100 Date: Thu, 21 Oct 2021 10:23:02 +0100 Message-ID: <87sfwubukp.wl-maz@kernel.org> From: Marc Zyngier To: zhaoxiao Cc: chenhuacai@kernel.org, jiaxun.yang@flygoat.com, tglx@linutronix.de, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, zhaoxiao Subject: Re: [PATCH] irqchip/loongson-htvec:- Handle return value of ioremap. In-Reply-To: <20211015072523.30615-1-long870912@gmail.com> References: <20211015072523.30615-1-long870912@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: long870912@gmail.com, chenhuacai@kernel.org, jiaxun.yang@flygoat.com, tglx@linutronix.de, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, zhaoxiao@uniontech.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Oct 2021 08:25:23 +0100, zhaoxiao wrote: > > From: zhaoxiao > > Here, If ioremap will fail. It will return NULL.Kernel can run into > a NULL-pointer dereference. This error check will avoid NULL pointer > dereference. > > Signed-off-by: zhaoxiao > --- > drivers/irqchip/irq-loongson-htvec.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c > index 1cc0bceb4472..a36c20f44ec4 100644 > --- a/drivers/irqchip/irq-loongson-htvec.c > +++ b/drivers/irqchip/irq-loongson-htvec.c > @@ -267,6 +267,8 @@ struct fwnode_handle *htvec_acpi_init(struct fwnode_handle *parent, > > priv->num_parents = HTVEC_MAX_PARENT_IRQ; > priv->base = ioremap(acpi_htvec->address, acpi_htvec->size); > + if (!priv->base) > + goto free_priv; > > /* Interrupt may come from any of the 8 interrupt lines */ > for (i = 0; i < priv->num_parents; i++) > @@ -307,6 +309,7 @@ struct fwnode_handle *htvec_acpi_init(struct fwnode_handle *parent, > iounmap_base: > iounmap(priv->base); > priv->domain_handle = NULL; > +free_priv: > kfree(priv); > > return NULL; I have no idea what code base this patch is against, but certainly not any upstream kernel. There is no trace of any ACPI support in this driver. Please only send patches that make sense for upstream. M. -- Without deviation from the norm, progress is not possible.