]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ray_cs: Check ioremap return value
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 30 Dec 2021 02:29:26 +0000 (10:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:06:34 +0000 (09:06 +0200)
[ Upstream commit 7e4760713391ee46dc913194b33ae234389a174e ]

As the possible failure of the ioremap(), the 'local->sram' and other
two could be NULL.
Therefore it should be better to check it in order to avoid the later
dev_dbg.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211230022926.1846757-1-jiasheng@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ray_cs.c

index c78abfc7bd96de89506a4705f58fe97a4ed8797d..784063b1e60f7f7ed22351fffb796548a54be4ca 100644 (file)
@@ -396,6 +396,8 @@ static int ray_config(struct pcmcia_device *link)
                goto failed;
        local->sram = ioremap(link->resource[2]->start,
                        resource_size(link->resource[2]));
+       if (!local->sram)
+               goto failed;
 
 /*** Set up 16k window for shared memory (receive buffer) ***************/
        link->resource[3]->flags |=
@@ -410,6 +412,8 @@ static int ray_config(struct pcmcia_device *link)
                goto failed;
        local->rmem = ioremap(link->resource[3]->start,
                        resource_size(link->resource[3]));
+       if (!local->rmem)
+               goto failed;
 
 /*** Set up window for attribute memory ***********************************/
        link->resource[4]->flags |=
@@ -424,6 +428,8 @@ static int ray_config(struct pcmcia_device *link)
                goto failed;
        local->amem = ioremap(link->resource[4]->start,
                        resource_size(link->resource[4]));
+       if (!local->amem)
+               goto failed;
 
        dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
        dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);