netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: check the return value of ioremap() in mhz_mfc_config()
@ 2022-08-02  7:28 studentxswpy
  2022-08-04  2:29 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: studentxswpy @ 2022-08-02  7:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, netdev, linux-kernel
  Cc: Xie Shaowen, Hacash Robot

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-04  2:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-02  7:28 [PATCH] net: check the return value of ioremap() in mhz_mfc_config() studentxswpy
2022-08-04  2:29 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).