Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp449409imi; Fri, 22 Jul 2022 02:36:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tG+EveOlQPTp0IxGWmiXQb8nLfV/lSoLrnR2GyUjtRjp+7yrYU0oicZKd1/HDXzMAvQ7ko X-Received: by 2002:a05:6a00:b4d:b0:52a:f2cf:b0e4 with SMTP id p13-20020a056a000b4d00b0052af2cfb0e4mr2890298pfo.2.1658482616142; Fri, 22 Jul 2022 02:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658482616; cv=none; d=google.com; s=arc-20160816; b=wUT5j+xdNvhyDrCcHz0DJAVOQLMOtG/EtqJXJS9vpQs81Fu/7ch61Nbr5B0i8Kkfr5 F+YBLdIardSxL1FQY99IArrMZKLoh4Tkl9NfVVVIgHh6LKQbuZfWqVgGc1dBwPEk9Tr7 lfDlfBEpS0FplUPRvjQyx/fSdREBKtkdLxwhXqSXN5OPjq9i9gbLux23BijB6hEEgPRT CspVjumMY635t3oC6aqNHEg5HhIR2L0p4kRsZt17f2LirSJ16BkQeSwUPhFItCcvqFK3 dyZR/SVT1FzPAn/AiAqc2P6zlQPzUxGvqSg/uP5ybRsKy7+EGGBsn1nU70KaxKmyTgxn uv8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=91/CzmrD4UcYML5SAR5j+BLCyBjt7JlxCwJDNjNiLWU=; b=qAAT0atsOYfRVClDelGtjnEkkXsfqYi9aJBnds9RLWrQ872S1w9OEHDKS5n7LGTlEJ lodj0qsg/KkeOPEXDmeq4kNzOQvIcJtsa932I7H6P/NzPvAA1/zq/iF6umMhJbZcGUpe /UdfqhZuebSy7Z227H2oS/ptNqO4N4JZflgzbjluFhfIQv5jFpCHslarGtMD3mNAjJBQ DjMmjxt5jS8wERkE1hfLIZ/CUX7IS5MzX6+//kcjiOkR4kDSezZUuiEGk6DxV7+WYIQe T4dmoCEoDuTKxGf8f+gkm49fwx+k1zMdAJ+45EZvDKDcdk98JJpACmXk7tt8CXm+7rZV ehgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=LwPBn9yS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k124-20020a633d82000000b0041a3b20ba0esi5302907pga.383.2022.07.22.02.36.31; Fri, 22 Jul 2022 02:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=LwPBn9yS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235374AbiGVJP7 (ORCPT + 99 others); Fri, 22 Jul 2022 05:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235603AbiGVJPL (ORCPT ); Fri, 22 Jul 2022 05:15:11 -0400 Received: from mail-m973.mail.163.com (mail-m973.mail.163.com [123.126.97.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98786AF968; Fri, 22 Jul 2022 02:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=91/Cz mrD4UcYML5SAR5j+BLCyBjt7JlxCwJDNjNiLWU=; b=LwPBn9yS3DiBcL7TB1K++ VAS7FGnkEown749bm1RuE4o5TAS9H399G44V1ChN525XvorcA/HxaZB/ykQDMmsO uoF5MnFAFVMbgcBsTE/3BTu+Eit6HcAJlUKbm90r9OLlOolfFo5lJ1FKeJKIV4v3 46crBEiAbOzZokLjoSKn/I= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp3 (Coremail) with SMTP id G9xpCgAHyoN4adpiosiOQg--.7264S2; Fri, 22 Jul 2022 17:10:18 +0800 (CST) From: williamsukatube@163.com To: tglx@linutronix.de, maz@kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: tsbogend@alpha.franken.de, fancer.lancer@gmail.com, William Dean , Hacash Robot Subject: [PATCH] irqchip: mips-gic: check the return value of ioremap() in gic_of_init() Date: Fri, 22 Jul 2022 17:10:08 +0800 Message-Id: <20220722091008.2937238-1-williamsukatube@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: G9xpCgAHyoN4adpiosiOQg--.7264S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWrAFW8ZF47Jw1kGr1rWFg_yoWDGrgE93 WYgFZxAFW8Ar18GFW7WrW7Z34UJ34kuF1vgr48ta43XrWxuw4xGr1avr15X3WUWFn2krZ8 CrZ5Z34IyF17AjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5t73PUUUUU== X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xzlozx5dpv3yxdwxuvi6rwjhhfrp/xtbB6BNGg2BHJoYekAAAs3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: William Dean The function ioremap() in gic_of_init() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Reported-by: Hacash Robot Signed-off-by: William Dean --- drivers/irqchip/irq-mips-gic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index ff89b36267dd..a1f6d955794a 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -734,6 +734,10 @@ static int __init gic_of_init(struct device_node *node, } mips_gic_base = ioremap(gic_base, gic_len); + if (!mips_gic_base) { + pr_err("Failed to ioremap gic_base\n"); + return -ENOMEM; + } gicconfig = read_gic_config(); gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig); -- 2.25.1