Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2895294rwb; Mon, 15 Aug 2022 13:30:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR5GFCt07uq28qEhydM7VuzBU9kBf1tcV3yJW5YCF4GQpWtGQyRZAt2wLguJDa6g+ypEDtor X-Received: by 2002:a17:907:7f24:b0:731:535e:b709 with SMTP id qf36-20020a1709077f2400b00731535eb709mr11392302ejc.160.1660595457305; Mon, 15 Aug 2022 13:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660595457; cv=none; d=google.com; s=arc-20160816; b=lax67QTZygEvp1ifLznrUt0TIWKRW8glLgG3wgM2aJYTADiOw0VjBgumNYz1Rzm4gd 9WRAKxF29u+hX0Mv/2drUFfY+ZeNYP16wRy7aL4CNwzH3bEm7UVK43a756RzPBvmJJUb Uz8I3KmrAoJcRHEJvzYJUlRFvhWnKChHmXN/YAkako7vUJybODPhEkn3w+pO5NWRLKCi 9J+4f7alaNgMv6WGoIFgyeOcdR6j/YxO1/Vv/90Kex8N61134ANDZ6PeZ2ESiJ1O9Env TxgWs/M/4qx7o/YgWEbgoV3CgG6NiJy0LP2qYeIeHmdA/ROAM6y0ybB9+TAZSLjy1S9r xyLA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aWnO6tI1GT4UG/c2FJF4h4sIuMa7YzKAsJ3uYmq+JRA=; b=SPZYQ8xTxt1hZwFtDjwcc3/CaGVJPQn/McH/xpx/fKjZN9xCvwnwMm9ZnVnQR/KtzV 2fnvc+8M/B7vO9p4g65p1KQfabcr4ZzJvhJKwPNPRVRqgTYVUP/+gKvX1BqJCLEDaWvw 1B62y5TyXna+XZFBXgmD3a9t/5PuP3dviJR/b9yBw/USk6XIHxfnJNFlfZlfFlPKMHGs u/53ek0HUtlq7wqFSEX0L8EDJK4my28THvwxGejoaTiUmYi5fN/1tj1SDGAxRpiGku8L gfoQinJSjp0aqSUODb9hkSopaNcgCdndzERfezFQStddQ55eKxWmToHtVOHLiMw/bmtV O/kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XIK5FNJD; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a056402270700b0043beaa7f1b3si9192295edd.247.2022.08.15.13.30.25; Mon, 15 Aug 2022 13:30:57 -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=@linuxfoundation.org header.s=korg header.b=XIK5FNJD; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346178AbiHOU1i (ORCPT + 99 others); Mon, 15 Aug 2022 16:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347243AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF7F4B0D0; Mon, 15 Aug 2022 12:01:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3505B810C6; Mon, 15 Aug 2022 19:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80CFC433D6; Mon, 15 Aug 2022 19:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590091; bh=8FaatRZzs5J89s4nJSmm66AsNZkhJ2K5cP0SUBU4jF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIK5FNJDBvOhGHNtKOoNgIHRX1k19Q8XZqO5h7mBGjlaIhdN1pwlAqxHrm82ANJo9 WqS6C04Eiv67wjpLJfjehVpM60AIJYt6wBkb4hld2f2xZj6/Lh85wMUiF4XpLDlY1b GHEbVjm2vUOS0OatdRYGnyvksHViunkDSI7Hkqtc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0148/1095] irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() Date: Mon, 15 Aug 2022 19:52:27 +0200 Message-Id: <20220815180435.711531285@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 [ Upstream commit 71349cc85e5930dce78ed87084dee098eba24b59 ] The function ioremap() in gic_of_init() can fail, so its return value should be checked. Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220723100128.2964304-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- 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 8a9efb6ae587..1ba0f1555c80 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -783,6 +783,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.35.1