Re: [PATCH] tty: 8250: fix a missing check for pci_ioremap_bar

From: Jiri Slaby
Date: Fri Mar 15 2019 - 01:44:03 EST


On 15. 03. 19, 5:56, Kangjie Lu wrote:
> pci_ioremap_bar could fail. The fix captures the failure and
> pass an error code upstream. This can avoid potential NULL
> pointer dereferences in the future.
>
> Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
> ---
> drivers/tty/serial/8250/8250_lpss.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index 98dbc796353f..e95332d8b35e 100644
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
...
> @@ -203,7 +207,7 @@ static void qrk_serial_exit_dma(struct lpss8250 *lpss)
> dw_dma_remove(&lpss->dma_chip);
> }
> #else /* CONFIG_SERIAL_8250_DMA */
> -static void qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port) {}
> +static int qrk_serial_setup_dma(struct lpss8250 *lpss, struct uart_port *port) {}

So you have to return something here now.

> static void qrk_serial_exit_dma(struct lpss8250 *lpss) {}
> #endif /* !CONFIG_SERIAL_8250_DMA */
>

regards,
--
js
suse labs