netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: studentxswpy@163.com
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hacash Robot <hacashRobot@santino.com>
Subject: Re: [PATCH] net: check the return value of ioremap() in mhz_mfc_config()
Date: Wed, 3 Aug 2022 19:29:31 -0700	[thread overview]
Message-ID: <20220803192931.52900f69@kernel.org> (raw)
In-Reply-To: <20220802072826.3212612-1-studentxswpy@163.com>

On Tue,  2 Aug 2022 15:28:26 +0800 studentxswpy@163.com wrote:
> 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()")

The check seems fine, but that's not the commit which added the
ioremap() without checking the result. You need to find the fix 
commit in the git history where the bug exists, not just run
git blame on the line in question.

> 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) &&


      reply	other threads:[~2022-08-04  2:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20220803192931.52900f69@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hacashRobot@santino.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=studentxswpy@163.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;
as well as URLs for NNTP newsgroup(s).