* [RFT PATCH] serial: amba-pl011: Fix devm_ioremap_resource return value check
@ 2015-07-09 13:21 Krzysztof Kozlowski
0 siblings, 0 replies; only message in thread
From: Krzysztof Kozlowski @ 2015-07-09 13:21 UTC (permalink / raw)
To: Russell King, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
linux-kernel
Cc: Krzysztof Kozlowski, stable
Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()")
---
Patch only compile tested.
---
drivers/tty/serial/amba-pl011.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 50cf5b10ceed..fd27e986b1dd 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
void __iomem *base;
base = devm_ioremap_resource(dev, mmiobase);
- if (!base)
- return -ENOMEM;
+ if (IS_ERR(base))
+ return PTR_ERR(base);
index = pl011_probe_dt_alias(index, dev);
--
2.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-09 13:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 13:21 [RFT PATCH] serial: amba-pl011: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).