DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async split ring
@ 2021-05-12  2:30 Cheng Jiang
  2021-05-12  8:40 ` Xia, Chenbo
  2021-05-12  8:42 ` Xia, Chenbo
  0 siblings, 2 replies; 3+ messages in thread
From: Cheng Jiang @ 2021-05-12  2:30 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, Cheng Jiang

Change the variable type in store_dma_desc_info_split() to fix
suspicious implicit sign extension.

Coverity issue: 370604, 370607, 370609
Fixes: 3d6cb86b0de5 (vhost: refactor async split ring functions)

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
---
 lib/vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8e36f4c340..9137a9923b 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -1474,7 +1474,7 @@ static __rte_always_inline void
 store_dma_desc_info_split(struct vring_used_elem *s_ring, struct vring_used_elem *d_ring,
 		uint16_t ring_size, uint16_t s_idx, uint16_t d_idx, uint16_t count)
 {
-	uint16_t elem_size = sizeof(struct vring_used_elem);
+	size_t elem_size = sizeof(struct vring_used_elem);
 
 	if (d_idx + count <= ring_size) {
 		rte_memcpy(d_ring + d_idx, s_ring + s_idx, count * elem_size);
-- 
2.29.2


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

end of thread, other threads:[~2021-05-12  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  2:30 [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async split ring Cheng Jiang
2021-05-12  8:40 ` Xia, Chenbo
2021-05-12  8:42 ` Xia, Chenbo

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).