Netdev List
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>, mst@redhat.com
Cc: netdev@vger.kernel.org
Subject: Re: dead code in vhost.c
Date: Fri, 15 Feb 2019 11:52:31 +0800	[thread overview]
Message-ID: <1a8aebb4-e82c-ed9b-5b06-6781f6f5b713@redhat.com> (raw)
In-Reply-To: <20190214080346.352c6941@shemminger-XPS-13-9360>


On 2019/2/15 上午12:03, Stephen Hemminger wrote:
> Coverity found this obvious bug
>
> ________________________________________________________________________________________________________
> *** CID 1442593:  Control flow issues  (DEADCODE)
> /drivers/vhost/vhost.c: 1795 in log_used()
> 1789     	ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
> 1790     			     len, iov, 64, VHOST_ACCESS_WO);
> 1791     	if (ret)
> 1792     		return ret;
> 1793
> 1794     	for (i = 0; i < ret; i++) {
>>>>      CID 1442593:  Control flow issues  (DEADCODE)
>>>>      Execution cannot reach this statement: "ret = log_write_hva(vq, (ui...".
> 1795     		ret = log_write_hva(vq,	(uintptr_t)iov[i].iov_base,
> 1796     				    iov[i].iov_len);
> 1797     		if (ret)
> 1798     			return ret;
> 1799     	}
> 1800


My bad, need check ret < 0 instead.

Will post a fix.

Thanks


      reply	other threads:[~2019-02-15  3:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 16:03 dead code in vhost.c Stephen Hemminger
2019-02-15  3:52 ` Jason Wang [this message]

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=1a8aebb4-e82c-ed9b-5b06-6781f6f5b713@redhat.com \
    --to=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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