[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190310.110127.1284658132202643848.davem@davemloft.net>
Date: Sun, 10 Mar 2019 11:01:27 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: kjlu@....edu
Cc: pakki001@....edu, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: 8390: fix potential NULL pointer dereferences
From: Kangjie Lu <kjlu@....edu>
Date: Sun, 10 Mar 2019 03:14:53 -0500
> In case ioremap fails, the fix returns to avoid NULL pointer
> dereferences.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/net/ethernet/8390/pcnet_cs.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c
> index 61e43802b9a5..d82ecedf7366 100644
> --- a/drivers/net/ethernet/8390/pcnet_cs.c
> +++ b/drivers/net/ethernet/8390/pcnet_cs.c
> @@ -289,6 +289,9 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link)
>
> virt = ioremap(link->resource[2]->start,
> resource_size(link->resource[2]));
> + if (unlikely(!virt))
> + return NULL;
Please retain the existing indentation, otherwise your changes are
impossible to read.
Powered by blists - more mailing lists