tty: mxs-auart: fix a potential NULL pointer dereference
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c85be04106
commit
6734330654
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user