Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2415596imn; Tue, 2 Aug 2022 01:47:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gmGm5y6nrnW1qsJ0tYdKsqlWqw1pBQbGMCdH7WYrlavuBl8LoTqm7az86pF8+xKYJjlg/ X-Received: by 2002:a17:906:8461:b0:730:a43a:9981 with SMTP id hx1-20020a170906846100b00730a43a9981mr679306ejc.552.1659430051560; Tue, 02 Aug 2022 01:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659430051; cv=none; d=google.com; s=arc-20160816; b=dbyYhJmjy81kdptsvozdp4StcPFvO8yEHjinKLiuCxE6GlkEYcGuTmCvR7+V+sxRx4 iQcutOYf8zLT6WUbpOG91I4K5LoICjNcvCbb+p8TpCrMT2HI76Qzu2B4ZH1c6PhOXRAt NA6WnmiXv2QASXxMDJCXU57/RjyecmJTC+dJnWIHSLfCSLpqj6P8HLoTM+1qHYwGytbW u3+oOFMTWfjUzFWv+B4WElCp2gdP+rcxX+AbweomoFY1OmirjLqHuXtrzkNpSuyexIB3 Pr/5oSzrvjZVMUyRIVb8AUnMtRmUXs3EEVzmuxuSdshbvl+Yd3UjNB4+JjXS8+V/FRXD KsyA== 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=RaLUeySVHWocZ18U4++qfFwHHyNFRwc6CeYMbKjIV+o=; b=d3gi2RbUKg4C85PtxcTl3eFADbA9J7D0+M/EOYOrIxgNOY6XFeilwcP/IHsEJx/RjE YwDuzyKJhPzqMeeVOhi3cOp9njCXYidTbKNme8DFAD9iNq9K8djc9/Sj1uFdaCYu0YO9 MdyPQ5Mrk4AkoZzPeGZuuN1tiQFzRmBXEZEKaK9X7C0bA5B0T2NzaxcrtRdKE0zda1SB ALiehvTSzSl9vzEv9ZyYUu3vrxf19Y/Wa2qLV1ZdPculy//CTwL5ijM/FJbv8Ubl3Stj hpExCv+m7PwKS64gp1P9ZeVH6wbu4rfSUHvXNOoMBgQLz4LI4TYB+74sHF4X0FVBQSLH Ytbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=XXFisJdd; 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 o10-20020a056402438a00b0043ddd6b93a8si1809158edc.468.2022.08.02.01.47.06; Tue, 02 Aug 2022 01:47:31 -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=XXFisJdd; 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 S236108AbiHBHqx (ORCPT + 99 others); Tue, 2 Aug 2022 03:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236099AbiHBHqt (ORCPT ); Tue, 2 Aug 2022 03:46:49 -0400 Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5AFA12DA9F; Tue, 2 Aug 2022 00:46:47 -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=RaLUe ySVHWocZ18U4++qfFwHHyNFRwc6CeYMbKjIV+o=; b=XXFisJdduEqEnk33vFr3s 2q8QzdNjU0fSHSptJw/CeeCELlAikCgvltBS5feANzPfrU/jl4Lmz5CCUshJxJWd 0NbImCV48ZHcG1RB8Op+nJcR278XdLj5JR9CdwOOgRQqeycn1NmWHcJSSMLKdD7R c3lHWq76eEntTJFZMSePh0= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp9 (Coremail) with SMTP id DcCowAAHE7gc0uhibtSZUg--.300S2; Tue, 02 Aug 2022 15:28:31 +0800 (CST) From: studentxswpy@163.com To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xie Shaowen , Hacash Robot Subject: [PATCH] net: check the return value of ioremap() in mhz_mfc_config() Date: Tue, 2 Aug 2022 15:28:26 +0800 Message-Id: <20220802072826.3212612-1-studentxswpy@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DcCowAAHE7gc0uhibtSZUg--.300S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw4kWr18Cr13Wry5Gr4kZwb_yoWDtrcEkF WIvF13tr4jgr1Ykw1jqr4xG3yYkr98uF4kXasFqrWFk347ZF1UWw1kZrykGw1fu3y8GFWD G39IvFZay347GjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8LjjDUUUUU== X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xvwxvv5qw024ls16il2tof0z/xtbBEQBRJFaEJ6ATSgAAso 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: Xie Shaowen The function ioremap() in mhz_mfc_config() can fail, so its return value should be checked. Fixes: cdb138080b781 ("pcmcia: do not use win_req_t when calling pcmcia_request_window()") Reported-by: Hacash Robot Signed-off-by: Xie Shaowen --- drivers/net/ethernet/smsc/smc91c92_cs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/smsc/smc91c92_cs.c b/drivers/net/ethernet/smsc/smc91c92_cs.c index 37c822e27207..14333f5bdcdc 100644 --- a/drivers/net/ethernet/smsc/smc91c92_cs.c +++ b/drivers/net/ethernet/smsc/smc91c92_cs.c @@ -446,6 +446,8 @@ static int mhz_mfc_config(struct pcmcia_device *link) smc->base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); + if (!smc->base) + return -ENOMEM; offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; i = pcmcia_map_mem_page(link, link->resource[2], offset); if ((i == 0) && -- 2.25.1