serial: mctrl_gpio: Check for NULL pointer
authorAdam Ford <aford173@gmail.com>
Sun, 6 Oct 2019 16:33:11 +0000 (11:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 11:21:54 +0000 (13:21 +0200)
commit37e3ab00e4734acc15d96b2926aab55c894f4d9c
tree65ba1c11ae2f099d73b6d193731bea47167fcc41
parent5df884d4b8a5bf2ec5e0b92394e40112d0a0a520
serial: mctrl_gpio: Check for NULL pointer

When using mctrl_gpio_to_gpiod, it dereferences gpios into a single
requested GPIO.  This dereferencing can break if gpios is NULL,
so this patch adds a NULL check before dereferencing it.  If
gpios is NULL, this function will also return NULL.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Link: https://lore.kernel.org/r/20191006163314.23191-1-aford173@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_mctrl_gpio.c