From: Xie Shaowen Date: Tue, 2 Aug 2022 07:20:33 +0000 (+0800) Subject: Input: gscps2 - check return value of ioremap() in gscps2_probe() X-Git-Tag: baikal/mips/sdk5.9~94 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=beda41a9ec5793244b6515cc4d7d519793d07644;p=kernel.git Input: gscps2 - check return value of ioremap() in gscps2_probe() 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: # v5.6+ Reported-by: Hacash Robot Signed-off-by: Xie Shaowen Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index a9065c6ab5508..da2c67cb86422 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -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);