[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220803192931.52900f69@kernel.org>
Date: Wed, 3 Aug 2022 19:29:31 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: studentxswpy@....com
Cc: davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Hacash Robot <hacashRobot@...tino.com>
Subject: Re: [PATCH] net: check the return value of ioremap() in
mhz_mfc_config()
On Tue, 2 Aug 2022 15:28:26 +0800 studentxswpy@....com wrote:
> From: Xie Shaowen <studentxswpy@....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@...tino.com>
> Signed-off-by: Xie Shaowen <studentxswpy@....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) &&
Powered by blists - more mailing lists