* dead code in vhost.c
@ 2019-02-14 16:03 Stephen Hemminger
2019-02-15 3:52 ` Jason Wang
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2019-02-14 16:03 UTC (permalink / raw)
To: mst, jasowang; +Cc: netdev
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: dead code in vhost.c
2019-02-14 16:03 dead code in vhost.c Stephen Hemminger
@ 2019-02-15 3:52 ` Jason Wang
0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2019-02-15 3:52 UTC (permalink / raw)
To: Stephen Hemminger, mst; +Cc: netdev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-15 3:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14 16:03 dead code in vhost.c Stephen Hemminger
2019-02-15 3:52 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox