Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp957153pxb; Wed, 6 Apr 2022 05:17:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvM3fBwlEMxSidcghXNXNapXh/vdCLl10IT7fC2Z54ytYPhCXEdmkifCmWxY2HXPGesc8V X-Received: by 2002:a17:903:40cd:b0:154:abdd:929d with SMTP id t13-20020a17090340cd00b00154abdd929dmr8516498pld.96.1649247451692; Wed, 06 Apr 2022 05:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247451; cv=none; d=google.com; s=arc-20160816; b=dsUpl0hdVj/SjMaI9WmeSoImUbc1mJLuEF9Qsq3qNpWySoUcJxyJ4fimFJHM/PK8U0 NK2M7TTixR0n4Up1sirHj8JODKDkCLqQeJ1May7+PN/QT87zFsOmtzhaeacwhKSpI/Hz tQWz883Kv6ZMbB0zSEJzcyefzkSukDCbn30iwEGMGjNW1x1t1HhEXx81C3XNy/uzZgaN bGU/7nzOGlR1ACuxFMBmKwsFlybasEzf+TaP+ceh5zE6x+24B9H2gMQ6sW+xaAvLviNr OzTTNmVQPQe+xeQkGPKZ34xh4LwHbnQfbd2VJCATSsEXQMUn6xjzn7etBU2MXNImOvVd 9UKg== 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=gTXAdm3omrX40A/G2NT/P1Z8X3FZpxhDyAMn1+ZxYTs=; b=wlsYHk4C6ShMU4SeJzBEh0gKGjMUoZb+1/1+sjMB0eKl6NiXEXZq+wL7UGOu2Gh7v0 B3noSBo9bJsiVWbNdeip5XtHvbq1kMJSe7HGf6w8/NpOFze7qnMix8YbYkwbfOlVyowI TP7UapVC3NvhCcmmxxnkpeZmRODDwKWO36D6f7FxTx55kbDS8bYLvQ6LiW/jkaghZd1z Vr92EmdVTuU7lRB6ws3YFqhmUgI8j+xkZcFvyVWj1r4eSLLnxsXRAIGmzoDJg9lD+PHz rTd9TML75bu09XBPFBeB52UEPH52Reyye2YUjjj4dTYqgRctInwWp8wPhsuoKe14Hced qS9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jWiYGlC0; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n7-20020a635c47000000b003816043ef09si13121792pgm.254.2022.04.06.05.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:17:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jWiYGlC0; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6F9A86C3643; Wed, 6 Apr 2022 03:59:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1451858AbiDEWaz (ORCPT + 99 others); Tue, 5 Apr 2022 18:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349024AbiDEJs7 (ORCPT ); Tue, 5 Apr 2022 05:48:59 -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 5C55520BCD; Tue, 5 Apr 2022 02:39:09 -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 B8C43615E5; Tue, 5 Apr 2022 09:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9313C385A3; Tue, 5 Apr 2022 09:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151548; bh=5DoZD7nxFoUba6pc6UdFOTkNrXWRDIPBAXrym04AgfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWiYGlC0Hb4CvhBlc8zwcpi5t6Y6RW2QaTfjw9iwQ+GufN414MhQVdXlRIozduQhX mqUZiol8vJkFvygjMHzRS8sOB9CTlAVuf0EcIgL6JSCw8VdUAzQ4Qyz9TuTKjLhi6B k4P0W46sClQWFe2rCvatGsWHbApVkXuiv7TlMx7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 417/913] ray_cs: Check ioremap return value Date: Tue, 5 Apr 2022 09:24:39 +0200 Message-Id: <20220405070352.346293767@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Jiasheng Jiang [ Upstream commit 7e4760713391ee46dc913194b33ae234389a174e ] As the possible failure of the ioremap(), the 'local->sram' and other two could be NULL. Therefore it should be better to check it in order to avoid the later dev_dbg. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiasheng Jiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211230022926.1846757-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/net/wireless/ray_cs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 0f5009c47cd0..f8409e93fe33 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->sram = ioremap(link->resource[2]->start, resource_size(link->resource[2])); + if (!local->sram) + goto failed; /*** Set up 16k window for shared memory (receive buffer) ***************/ link->resource[3]->flags |= @@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->rmem = ioremap(link->resource[3]->start, resource_size(link->resource[3])); + if (!local->rmem) + goto failed; /*** Set up window for attribute memory ***********************************/ link->resource[4]->flags |= @@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->amem = ioremap(link->resource[4]->start, resource_size(link->resource[4])); + if (!local->amem) + goto failed; dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); -- 2.34.1