Thread (2 messages) 2 messages, 2 authors, 2022-08-02
STALE1417d

[PATCH] Input: check the return value of ioremap() in gscps2_probe()

From: <hidden>
Date: 2022-08-02 07:21:36
Also in: lkml
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, parisc architecture, the rest · Maintainers: Dmitry Torokhov, "James E.J. Bottomley", Helge Deller, Linus Torvalds

From: Xie Shaowen <redacted>

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

Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache")
Reported-by: Hacash Robot <redacted>
Signed-off-by: Xie Shaowen <redacted>
---
 drivers/input/serio/gscps2.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index a9065c6ab550..da2c67cb8642 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);
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help