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 via email to