Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: michael@walle.cc
Cc: linux-serial@vger.kernel.org
Subject: [bug report] tty: serial: fsl_lpuart: fix DMA mapping
Date: Mon, 6 Apr 2020 17:42:43 +0300	[thread overview]
Message-ID: <20200406144243.GB68494@mwanda> (raw)

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

             reply	other threads:[~2020-04-06 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 14:42 Dan Carpenter [this message]
2020-04-06 14:48 ` [bug report] tty: serial: fsl_lpuart: fix DMA mapping Michael Walle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200406144243.GB68494@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=michael@walle.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox