DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: fix unchecked return value
@ 2022-06-23  1:08 Jiayu Hu
  2022-06-23  2:44 ` Xia, Chenbo
  2022-06-29  9:07 ` [PATCH v2] " Jiayu Hu
  0 siblings, 2 replies; 8+ messages in thread
From: Jiayu Hu @ 2022-06-23  1:08 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, chenbo.xia, 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")

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-01 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23  1:08 [PATCH] vhost: fix unchecked return value Jiayu Hu
2022-06-23  2:44 ` Xia, Chenbo
2022-06-29  9:07 ` [PATCH v2] " Jiayu Hu
2022-06-30  9:56   ` Maxime Coquelin
2022-07-01  7:11     ` Hu, Jiayu
2022-07-01  7:52       ` Maxime Coquelin
2022-07-01 13:59   ` Maxime Coquelin
2022-07-01 14:11     ` Hu, Jiayu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).