serial: fsl_lpuart: Fix out-of-bounds access through DT alias
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 23 Feb 2018 13:38:30 +0000 (14:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Feb 2018 14:29:59 +0000 (15:29 +0100)
commitffab87fdecc655cc676f8be8dd1a2c5e22bd6d47
treeb87672bd402ff677c63b8f4f046234d8a8fc1551
parentf9f5786987e81d166c60833edcb7d1836aa16944
serial: fsl_lpuart: Fix out-of-bounds access through DT alias

The lpuart_ports[] array is indexed using a value derived from the
"serialN" alias in DT, which may lead to an out-of-bounds access.

Fix this by adding a range check.

Fixes: c9e2e946fb0ba5d2 ("tty: serial: add Freescale lpuart driver support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c