Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2813865rwb; Mon, 15 Aug 2022 11:52:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4+4YajCspCr1dvJFczSORTmAeRX2Ugwc0ChrCLVAXerKit4CCP4hetl+xDBLQn2g5pUkoo X-Received: by 2002:a05:6402:348f:b0:43d:e568:97bd with SMTP id v15-20020a056402348f00b0043de56897bdmr15342183edc.279.1660589576385; Mon, 15 Aug 2022 11:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589576; cv=none; d=google.com; s=arc-20160816; b=Fu7B33r4ofYDpU4e4dvYVK+UrGwsSMeSjxbl9KUqjZYmR1ehxb51eXKpuXLDDnCMey 2AO0ClSbPmGLc2tyFlDaqzDI9x1G2VcCKYdol2iYeWmCJ79T1l6DCWXYcj4CyYWI0mIw G3qWUFw9hYvUatSf22Ppp3+kapiQRoYFNCly+OiYk1JQ6hOQAnJuOvLdbBQYoxBCgY5p YqoTwgi5bM3uo3vLaQJsq0x4yKZfZgVH2Mm6VljXe4d+3kn0NSwQfLuNOBY2pfbCQOlM dzqIiDgg+e4lIj6W8g1mYoR+Jbj0dP48AxHYLHSJ5yJpTWeoNxu3t9WK/pA5N+MxrG8t 86mA== 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=g5G4RhLi3Z+HlLWFjhLsEIjRohpq2tDun2J+dsyqnYc=; b=Z7yLFEq2QZNwdL+wYiYlVmGhy32Gokc6H++CkftIfNMIC75s+A7x7K1hTWXam3wZeZ RDZwQBoW8G4el1XoTw+zL2EW1NYaS0yczIRmZHLsRclwwm3iOiyuX9/7HHoc4fq561Gc DKV9ZCybkoiYlESyQ4olgDm2Dc2UoEO2YWXBmDUeSSZgAvjQvxVbcGqI0NzVCHgJgPow UtiZvH6U4bXAHkea1kC2TWR0FT2RjwygjgnPsgDYiX+LUhxscq+xLoCs0CPiZBwuKpC1 AfxUdNhGhEeIhxrwXJVe5Iijf/kCVYEUbbPFYlrAF5pCShaRylTFldzvmeMgRTBO+KLJ Ig0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1cN178ji; 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 hv9-20020a17090760c900b007357974fe2bsi4628761ejc.433.2022.08.15.11.52.26; Mon, 15 Aug 2022 11:52: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=@linuxfoundation.org header.s=korg header.b=1cN178ji; 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 S242928AbiHOSbn (ORCPT + 99 others); Mon, 15 Aug 2022 14:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243063AbiHOSai (ORCPT ); Mon, 15 Aug 2022 14:30:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 412072AE0C; Mon, 15 Aug 2022 11:20:47 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 2405560693; Mon, 15 Aug 2022 18:20:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F3B0C433C1; Mon, 15 Aug 2022 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587645; bh=UkgRBGRGiND0e5vjUxLk3kZH+BsEyc38Jo903maH+RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1cN178jiQzkJJXwStn8VggaggE0IOSQE1nnVtRtoAVZ7+kUiYGHJJ4lWTcdCxDl5x R6sEFMucHGgsHw8i28l7W25Y60B2Q0jC3/P56ue32BfJEZB3F4EdJUzVaal6T3FwBw M5QBhgMKp7iyOSOnQL+zSiqE45fEEfR13abspHz4= 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.15 122/779] irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() Date: Mon, 15 Aug 2022 19:56:06 +0200 Message-Id: <20220815180342.526837221@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 f03f47ffea1e..d815285f1efe 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -767,6 +767,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 = gicconfig & GIC_CONFIG_NUMINTERRUPTS; -- 2.35.1