All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linjiasen@hygon.cn
Cc: linux-ntb@googlegroups.com
Subject: [bug report] NTB: ntb_perf: Fix address err in perf_copy_chunk
Date: Mon, 6 Apr 2020 13:41:05 +0300	[thread overview]
Message-ID: <20200406104105.GA34519@mwanda> (raw)

Hello Jiasen Lin,

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

The patch 99a06056124d: "NTB: ntb_perf: Fix address err in
perf_copy_chunk" from Nov 20, 2019, leads to the following Smatch
complaint:

    drivers/ntb/test/ntb_perf.c:1017 perf_clear_test()
    warn: variable dereferenced before check 'pthr->dma_chan' (see line 1011)

drivers/ntb/test/ntb_perf.c
  1010		 */
  1011		(void)dmaengine_terminate_sync(pthr->dma_chan);
                                               ^^^^^^^^^^^^^^
"pthr->dma_chan" is dereferenced inside the function.

  1012		if (pthr->perf->test_peer->dma_dst_addr)
  1013			dma_unmap_resource(pthr->dma_chan->device->dev,
  1014					   pthr->perf->test_peer->dma_dst_addr,
  1015					   pthr->perf->test_peer->outbuf_size,
  1016					   DMA_FROM_DEVICE, 0);
  1017		if (pthr->dma_chan)
                    ^^^^^^^^^^^^^^
This new NULL check is too late.

  1018			dma_release_channel(pthr->dma_chan);
  1019	

regards,
dan carpenter

             reply	other threads:[~2020-04-06 10:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 10:41 Dan Carpenter [this message]
2020-04-08  4:33 ` [bug report] NTB: ntb_perf: Fix address err in perf_copy_chunk Jiasen Lin

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=20200406104105.GA34519@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linjiasen@hygon.cn \
    --cc=linux-ntb@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.