From: Cheng Jiang <cheng1.jiang@intel.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, Cheng Jiang <cheng1.jiang@intel.com>
Subject: [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring
Date: Wed, 12 May 2021 02:30:56 +0000 [thread overview]
Message-ID: <20210512023056.30558-1-cheng1.jiang@intel.com> (raw)
Change the variable type in store_dma_desc_info_packed() to fix
suspicious implicit sign extension.
Coverity issue: 370608, 370610, 370612
Fixes: 873e8dad6f49 (vhost: support packed ring in async datapath)
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 9137a9923b..abfd67d38c 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -1491,7 +1491,7 @@ store_dma_desc_info_packed(struct vring_used_elem_packed *s_ring,
struct vring_used_elem_packed *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_packed);
+ size_t elem_size = sizeof(struct vring_used_elem_packed);
if (d_idx + count <= ring_size) {
rte_memcpy(d_ring + d_idx, s_ring + s_idx, count * elem_size);
--
2.29.2
next reply other threads:[~2021-05-12 2:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-12 2:30 Cheng Jiang [this message]
2021-05-12 8:41 ` Xia, Chenbo
2021-05-12 8:42 ` Xia, Chenbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210512023056.30558-1-cheng1.jiang@intel.com \
--to=cheng1.jiang@intel.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).