* [PATCH] tty: mxs-auart: fix a NULL pointer dereference
@ 2019-03-14 7:21 ` Kangjie Lu
0 siblings, 0 replies; 2+ messages in thread
From: Kangjie Lu @ 2019-03-14 7:21 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Greg Kroah-Hartman, Jiri Slaby, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, linux-serial, linux-arm-kernel, linux-kernel
In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereferences.
Multiple places use port.membase.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/tty/serial/mxs-auart.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 27235a526cce..4c188f4079b3 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -1686,6 +1686,10 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->port.mapbase = r->start;
s->port.membase = ioremap(r->start, resource_size(r));
+ if (!s->port.membase) {
+ ret = -ENOMEM;
+ goto out_disable_clks;
+ }
s->port.ops = &mxs_auart_ops;
s->port.iotype = UPIO_MEM;
s->port.fifosize = MXS_AUART_FIFO_SIZE;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] tty: mxs-auart: fix a NULL pointer dereference
@ 2019-03-14 7:21 ` Kangjie Lu
0 siblings, 0 replies; 2+ messages in thread
From: Kangjie Lu @ 2019-03-14 7:21 UTC (permalink / raw)
To: kjlu
Cc: Fabio Estevam, linux-serial, Greg Kroah-Hartman, Sascha Hauer,
pakki001, linux-kernel, NXP Linux Team, Pengutronix Kernel Team,
Jiri Slaby, Shawn Guo, linux-arm-kernel
In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereferences.
Multiple places use port.membase.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/tty/serial/mxs-auart.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 27235a526cce..4c188f4079b3 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -1686,6 +1686,10 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->port.mapbase = r->start;
s->port.membase = ioremap(r->start, resource_size(r));
+ if (!s->port.membase) {
+ ret = -ENOMEM;
+ goto out_disable_clks;
+ }
s->port.ops = &mxs_auart_ops;
s->port.iotype = UPIO_MEM;
s->port.fifosize = MXS_AUART_FIFO_SIZE;
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-14 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 7:21 [PATCH] tty: mxs-auart: fix a NULL pointer dereference Kangjie Lu
2019-03-14 7:21 ` Kangjie Lu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.