mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 <studentxswpy@163.com>,
	Hacash Robot <hacashRobot@santino.com>
Subject: [PATCH] net: check the return value of ioremap() in mhz_mfc_config()
Date: Tue,  2 Aug 2022 15:28:26 +0800	[thread overview]
Message-ID: <20220802072826.3212612-1-studentxswpy@163.com> (raw)

From: Xie Shaowen <studentxswpy@163.com>

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 <hacashRobot@santino.com>
Signed-off-by: Xie Shaowen <studentxswpy@163.com>
---
 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


             reply	other threads:[~2022-08-02  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  7:28 studentxswpy [this message]
2022-08-04  2:29 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220802072826.3212612-1-studentxswpy@163.com \
    --to=studentxswpy@163.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hacashRobot@santino.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®