Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: teppei.kamijou.yb@renesas.com
Cc: linux-mmc@vger.kernel.org
Subject: re: mmc: sh_mmcif: Terminate DMA transactions when detecting timeout or error
Date: Wed, 6 Nov 2013 19:15:29 +0300	[thread overview]
Message-ID: <20131106161529.GH15603@elgon.mountain> (raw)

Hello Teppei Kamijou,

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

The patch eae309836509: "mmc: sh_mmcif: Terminate DMA transactions 
when detecting timeout or error" from Dec 12, 2012, leads to the 
following Smatch complaint:

drivers/mmc/host/sh_mmcif.c:1122 sh_mmcif_end_cmd()
	 error: we previously assumed 'host->chan_rx' could be null (see line 1105)

drivers/mmc/host/sh_mmcif.c
  1104		if (data->flags & MMC_DATA_READ) {
  1105			if (host->chan_rx)
                            ^^^^^^^^^^^^^
Existing check.

  1106				sh_mmcif_start_dma_rx(host);
  1107		} else {
  1108			if (host->chan_tx)
  1109				sh_mmcif_start_dma_tx(host);
  1110		}
  1111	
  1112		if (!host->dma_active) {
  1113			data->error = sh_mmcif_data_trans(host, host->mrq, cmd->opcode);
  1114			return !data->error;
  1115		}
  1116	
  1117		/* Running in the IRQ thread, can sleep */
  1118		time = wait_for_completion_interruptible_timeout(&host->dma_complete,
  1119								 host->timeout);
  1120	
  1121		if (data->flags & MMC_DATA_READ)
  1122			dma_unmap_sg(host->chan_rx->device->dev,
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
Patch introduces new unchecked dereference.

Same thing for chan_tx as well.

  1123				     data->sg, data->sg_len,
  1124				     DMA_FROM_DEVICE);

regards,
dan carpenter

                 reply	other threads:[~2013-11-06 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20131106161529.GH15603@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=teppei.kamijou.yb@renesas.com \
    /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