]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Input: gscps2 - check return value of ioremap() in gscps2_probe()
authorXie Shaowen <studentxswpy@163.com>
Tue, 2 Aug 2022 07:20:33 +0000 (15:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:19 +0000 (14:24 +0200)
commit c48a321190e98cb72ca0b653fa3d733bea9d7578 upstream.

The function ioremap() in gscps2_probe() can fail, so
its return value should be checked.

Fixes: 32c5fd4883e3c ("remove ioremap_nocache and devm_ioremap_nocache")
Cc: <stable@vger.kernel.org> # v5.6+
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: Xie Shaowen <studentxswpy@163.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/serio/gscps2.c

index a9065c6ab5508dcb9871557ae9f9159e45db2b5c..da2c67cb864225a3b917da1992a7a54a07c784e7 100644 (file)
@@ -350,6 +350,10 @@ static int __init gscps2_probe(struct parisc_device *dev)
        ps2port->port = serio;
        ps2port->padev = dev;
        ps2port->addr = ioremap(hpa, GSC_STATUS + 4);
+       if (!ps2port->addr) {
+               ret = -ENOMEM;
+               goto fail_nomem;
+       }
        spin_lock_init(&ps2port->lock);
 
        gscps2_reset(ps2port);