[PATCH v2 7/9] serial: sh-sci: Fix out-of-bounds access through DT alias

2018-02-23 Thread Geert Uytterhoeven
The sci_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. Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_SH_SCI_NR_UARTS), so this can even be triggered using a

[PATCH v2 7/9] serial: sh-sci: Fix out-of-bounds access through DT alias

2018-02-23 Thread Geert Uytterhoeven
The sci_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. Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_SH_SCI_NR_UARTS), so this can even be triggered using a