* [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring
@ 2021-05-12 2:30 Cheng Jiang
2021-05-12 8:41 ` 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_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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring
2021-05-12 2:30 [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring Cheng Jiang
@ 2021-05-12 8:41 ` Xia, Chenbo
2021-05-12 8:42 ` Xia, Chenbo
1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-05-12 8:41 UTC (permalink / raw)
To: Jiang, Cheng1, maxime.coquelin; +Cc: dev
> -----Original Message-----
> From: Jiang, Cheng1 <cheng1.jiang@intel.com>
> Sent: Wednesday, May 12, 2021 10:31 AM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Jiang, Cheng1 <cheng1.jiang@intel.com>
> Subject: [PATCH] vhost: fix unintended sign extension in async packed ring
>
> 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)
Miss "" here. Will add them when applying.
>
> 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
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring
2021-05-12 2:30 [dpdk-dev] [PATCH] vhost: fix unintended sign extension in async packed ring Cheng Jiang
2021-05-12 8:41 ` Xia, Chenbo
@ 2021-05-12 8:42 ` Xia, Chenbo
1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-05-12 8:42 UTC (permalink / raw)
To: Jiang, Cheng1, maxime.coquelin; +Cc: dev
> -----Original Message-----
> From: Jiang, Cheng1 <cheng1.jiang@intel.com>
> Sent: Wednesday, May 12, 2021 10:31 AM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Jiang, Cheng1 <cheng1.jiang@intel.com>
> Subject: [PATCH] vhost: fix unintended sign extension in async packed ring
>
> 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
Applied to next-virtio/main with commit log fixed. Thanks
^ 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 packed ring Cheng Jiang
2021-05-12 8:41 ` 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).