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 AC879A0544 for ; Wed, 29 Jun 2022 11:07:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5B9A4280E; Wed, 29 Jun 2022 11:07:13 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id D889D410D5; Wed, 29 Jun 2022 11:07:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656493631; x=1688029631; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mTkqAo9DukenBIR4FJAjXXrcZExFl0QK5bhSfvzaiOg=; b=AzDSL8dkuBONcCeuSA5cbDoLMpDr44hRc7aSwSjE1IvuJtYj99P6/G+I plWEO93aIPsulQB6hX5px+7eDpUkLZ9RUxPlf7XUM7XZgSdzhq+g0fGkk 9T9g6b+E7nTxwxrbvgwiD7PD+L5BvDoqgBnXK+zdaRoj3BXEC7ooE1Ppn sewaXm3QQ1KM9N4VyZCfAhCN2kA9qNdXr2KyKlA//SBfi7bFQVTB/hUlz SXe1AADnPepgDqSUQQmhZKPjHiCNarnz/ixUl/Pe2OtiRmlD0TX+J6zh2 uESLzsLpRg8+N/71kqbdKxnTj2yHxhTRG6yIbu/3mKN145EBIayS+zpHk w==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="343668129" X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="343668129" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2022 02:07:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="837052646" Received: from npg-dpdk-virtio-jiayuhu-117.sh.intel.com ([10.67.119.202]) by fmsmga006.fm.intel.com with ESMTP; 29 Jun 2022 02:07:08 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, Jiayu Hu , stable@dpdk.org Subject: [PATCH v2] vhost: fix unchecked return value Date: Wed, 29 Jun 2022 05:07:06 -0400 Message-Id: <20220629090706.1395614-1-jiayu.hu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220623010858.951367-1-jiayu.hu@intel.com> References: <20220623010858.951367-1-jiayu.hu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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; -- 2.25.1