From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8FF9C43381 for ; Fri, 15 Feb 2019 03:52:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 715E521927 for ; Fri, 15 Feb 2019 03:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730540AbfBODwi (ORCPT ); Thu, 14 Feb 2019 22:52:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48140 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729970AbfBODwh (ORCPT ); Thu, 14 Feb 2019 22:52:37 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2A0F8E3FD; Fri, 15 Feb 2019 03:52:37 +0000 (UTC) Received: from [10.72.12.183] (ovpn-12-183.pek2.redhat.com [10.72.12.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C444101E85C; Fri, 15 Feb 2019 03:52:34 +0000 (UTC) Subject: Re: dead code in vhost.c To: Stephen Hemminger , mst@redhat.com Cc: netdev@vger.kernel.org References: <20190214080346.352c6941@shemminger-XPS-13-9360> From: Jason Wang Message-ID: <1a8aebb4-e82c-ed9b-5b06-6781f6f5b713@redhat.com> Date: Fri, 15 Feb 2019 11:52:31 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190214080346.352c6941@shemminger-XPS-13-9360> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 15 Feb 2019 03:52:37 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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