Linux Serial subsystem development
 help / color / mirror / Atom feed
* [bug report] tty: serial: fsl_lpuart: fix DMA mapping
@ 2020-04-06 14:42 Dan Carpenter
  2020-04-06 14:48 ` Michael Walle
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-04-06 14:42 UTC (permalink / raw)
  To: michael; +Cc: linux-serial

Hello Michael Walle,

This is a semi-automatic email about new static checker warnings.

The patch a092ab25fdaa: "tty: serial: fsl_lpuart: fix DMA mapping" 
from Mar 6, 2020, leads to the following Smatch complaint:

    drivers/tty/serial/fsl_lpuart.c:1237 lpuart_dma_rx_free()
    error: we previously assumed 'chan' could be null (see line 1234)

drivers/tty/serial/fsl_lpuart.c
  1228  static void lpuart_dma_rx_free(struct uart_port *port)
  1229  {
  1230          struct lpuart_port *sport = container_of(port,
  1231                                          struct lpuart_port, port);
  1232          struct dma_chan *chan = sport->dma_rx_chan;
  1233	
  1234		if (chan)
                    ^^^^
The patch adds a check

  1235			dmaengine_terminate_all(chan);
  1236	
  1237		dma_unmap_sg(chan->device->dev, &sport->rx_sgl, 1, DMA_FROM_DEVICE);
                             ^^^^^^
and an unchecked dereference.

  1238		kfree(sport->rx_ring.buf);
  1239		sport->rx_ring.tail = 0;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-06 14:42 [bug report] tty: serial: fsl_lpuart: fix DMA mapping Dan Carpenter
2020-04-06 14:48 ` Michael Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox