Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp663387pxb; Tue, 5 Apr 2022 17:50:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmcOBvEkv1H0AyKE50OFGAIoSSSDDwzf/Fz3W+cjYw4TvCZglq2wkuaa2Tlgo5EcGNXNVF X-Received: by 2002:a17:907:980b:b0:6e0:71d9:c87e with SMTP id ji11-20020a170907980b00b006e071d9c87emr5831538ejc.510.1649206248262; Tue, 05 Apr 2022 17:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649206248; cv=none; d=google.com; s=arc-20160816; b=aZEG3fZ6DmeLUkM5o1rrI4pM8yzuCwQQLUgMOCo520afzSl8kxeyU0lHIxEX8SSxRe /l8VlvcvQ/SPXyv6TNCLv2YgwssJEdu/t36mcgCpIJ0Y6iTixQJK110F5HH9ueWuLIGb hihTDq9BpQubzDM7bYYqxBVzXveoGQp+F0jkn+g0joqeFqxU5u6T8SX0Dy3Y9FxXnnW2 WXR/hDF3Wp9VSRkx84cEkBjALDrmdrpuylEYu/BYEc52deiv1LKHTCCX0qD5Y/bzycfq UdGXLmED7xiMuq4irOA4jm0WtqLJhhlkTy/UTOQtWjCxnsBgC+hnNt4U81yrj9v1CBQY QuQg== 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=aApDvFBtWclfd5miIa3Ua0b8kl/UdQnTVfsH73I1hOs=; b=C9HUDjfyTG/wO2TpzFoC1HwMO9cQQtlhKorhDLNAqvUDGk7EjZOLjCDIQ+YNhVgo39 pT7soN3Cah6onDhCJ/iIsD6wZIRXcnT6S81qhImDlgnneRTQiVu/wG5WP+ocj1dDMJTu C/Pml2qmltxXyrTl3EZEKKeSqIjgHHsgylbHumuP8HI0H/IKeTDWnB8rkVlRniC+GFS4 tvZmbOLCg+2LBI/4tQitPaYgihpdmyYztkZFdI6dgl5bGObtsWhGfc/0IbIFvmWbw5HV IS4fpKWF6Xj4g4cwPBuYrH1uX1ZghVtWZGWndfjKpLta4XCj82BpfeU6WxrmKDvmu/ud WfIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gbw4hS5i; 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 g13-20020a056402090d00b0041b6412d2cesi13121906edz.171.2022.04.05.17.50.23; Tue, 05 Apr 2022 17:50:48 -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=Gbw4hS5i; 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 S1383328AbiDEMZc (ORCPT + 99 others); Tue, 5 Apr 2022 08:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245145AbiDEIyL (ORCPT ); Tue, 5 Apr 2022 04:54:11 -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 B309810B1; Tue, 5 Apr 2022 01:51: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 dfw.source.kernel.org (Postfix) with ESMTPS id 51AC161509; Tue, 5 Apr 2022 08:51:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64F19C385A1; Tue, 5 Apr 2022 08:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148692; bh=MVxePCla/yh9VomTi1kSVADbmcpNtjfV/ElXGmjyMVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gbw4hS5ih9KvGLpSA/rLqe6YEbKNusneiDlIL6nVqs3R6VtpJdGe/EzrBP0YLbKO5 uxouibBa6+lwcZ8dId5CSxat61bukb/pr5CJ+oJ6b0ZA5qAnDl+xc3SSiMrDRQsrq3 kV5q1/E1y5enFCTMoRfZqa6hALxbuVxPML3N067E= 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.16 0447/1017] ray_cs: Check ioremap return value Date: Tue, 5 Apr 2022 09:22:40 +0200 Message-Id: <20220405070407.566396878@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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=-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: 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 e3a3dc3e45b4..03f0953440b5 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