From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B427AA0554 for ; Thu, 30 Jun 2022 03:22:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AA6740A7D; Thu, 30 Jun 2022 03:22:31 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 9D09A40A7D for ; Thu, 30 Jun 2022 03:22:29 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LYL9P4CYrzhYyV for ; Thu, 30 Jun 2022 09:20:09 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 09:22:27 +0800 Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 09:22:26 +0800 Message-ID: Date: Thu, 30 Jun 2022 09:22:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2] vhost: fix unchecked return value To: References: <20220623010858.951367-1-jiayu.hu@intel.com> <20220629090706.1395614-1-jiayu.hu@intel.com> From: "lihuisong (C)" In-Reply-To: <20220629090706.1395614-1-jiayu.hu@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 在 2022/6/29 17:07, Jiayu Hu 写道: > This patch checks the return value of rte_dma_info_get() > called in rte_vhost_async_dma_configure(). > > Coverity issue: 379066 > Fixes: 53d3f4778c1d ("vhost: integrate dmadev in asynchronous data-path") > Cc: stable@dpdk.org > > Signed-off-by: Jiayu Hu > Reviewed-by: Chenbo Xia > --- > v2: > - add cc stable tag > --- > lib/vhost/vhost.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c > index b14521e4d1..70c04c036e 100644 > --- a/lib/vhost/vhost.c > +++ b/lib/vhost/vhost.c > @@ -1868,7 +1868,11 @@ rte_vhost_async_dma_configure(int16_t dma_id, uint16_t vchan_id) > return -1; > } > > - rte_dma_info_get(dma_id, &info); > + if (rte_dma_info_get(dma_id, &info) != 0) { > + VHOST_LOG_CONFIG(ERR, "Fail to get DMA %d information.\n", dma_id); > + return -1; > + } > + > if (vchan_id >= info.max_vchans) { > VHOST_LOG_CONFIG(ERR, "Invalid DMA %d vChannel %u.\n", dma_id, vchan_id); > return -1; Reviewed-by: Huisong Li