DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/vhost: fix potentially overflowing expression
@ 2021-02-02  6:28 Cheng Jiang
  2021-02-02  7:24 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
  0 siblings, 1 reply; 4+ messages in thread
From: Cheng Jiang @ 2021-02-02  6:28 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, yvonnex.yang, Cheng Jiang

Change the type of buff_idx from uint64_t to uint32_t to fix coverity
issue.

Fixes: a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")
Coverity issue: 366264

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

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 233a2dc6e..e74fc8750 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -864,7 +864,7 @@ static __rte_always_inline void
 drain_vhost(struct vhost_dev *vdev)
 {
 	uint16_t ret;
-	uint64_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
+	uint32_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
 	uint16_t nr_xmit = vhost_txbuff[buff_idx]->len;
 	struct rte_mbuf **m = vhost_txbuff[buff_idx]->m_table;
 
-- 
2.29.2


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

* [dpdk-dev] [PATCH v2] examples/vhost: fix potentially overflowing expression
  2021-02-02  6:28 [dpdk-dev] [PATCH] examples/vhost: fix potentially overflowing expression Cheng Jiang
@ 2021-02-02  7:24 ` Cheng Jiang
  2021-02-03  9:54   ` Maxime Coquelin
  2021-02-03 17:20   ` Maxime Coquelin
  0 siblings, 2 replies; 4+ messages in thread
From: Cheng Jiang @ 2021-02-02  7:24 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, yvonnex.yang, Cheng Jiang

Change the type of buff_idx from uint64_t to uint32_t to fix coverity
issue.

Coverity issue: 366264
Fixes: a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
---
v2: fixed the format of git log

 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 233a2dc6e..e74fc8750 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -864,7 +864,7 @@ static __rte_always_inline void
 drain_vhost(struct vhost_dev *vdev)
 {
 	uint16_t ret;
-	uint64_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
+	uint32_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
 	uint16_t nr_xmit = vhost_txbuff[buff_idx]->len;
 	struct rte_mbuf **m = vhost_txbuff[buff_idx]->m_table;

--
2.29.2


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

* Re: [dpdk-dev] [PATCH v2] examples/vhost: fix potentially overflowing expression
  2021-02-02  7:24 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
@ 2021-02-03  9:54   ` Maxime Coquelin
  2021-02-03 17:20   ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2021-02-03  9:54 UTC (permalink / raw)
  To: Cheng Jiang, chenbo.xia; +Cc: dev, jiayu.hu, yvonnex.yang



On 2/2/21 8:24 AM, Cheng Jiang wrote:
> Change the type of buff_idx from uint64_t to uint32_t to fix coverity
> issue.
> 
> Coverity issue: 366264
> Fixes: a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")
> 
> Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
> ---
> v2: fixed the format of git log
> 
>  examples/vhost/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 233a2dc6e..e74fc8750 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -864,7 +864,7 @@ static __rte_always_inline void
>  drain_vhost(struct vhost_dev *vdev)
>  {
>  	uint16_t ret;
> -	uint64_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
> +	uint32_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
>  	uint16_t nr_xmit = vhost_txbuff[buff_idx]->len;
>  	struct rte_mbuf **m = vhost_txbuff[buff_idx]->m_table;
> 
> --
> 2.29.2
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


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

* Re: [dpdk-dev] [PATCH v2] examples/vhost: fix potentially overflowing expression
  2021-02-02  7:24 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
  2021-02-03  9:54   ` Maxime Coquelin
@ 2021-02-03 17:20   ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2021-02-03 17:20 UTC (permalink / raw)
  To: Cheng Jiang, chenbo.xia; +Cc: dev, jiayu.hu, yvonnex.yang



On 2/2/21 8:24 AM, Cheng Jiang wrote:
> |Change the type of buff_idx from uint64_t to uint32_t to fix coverity
> issue. Coverity issue: 366264 Fixes: a68ba8e0a6b6 ("examples/vhost:
> refactor vhost data path") Signed-off-by: Cheng Jiang
> <Cheng1.jiang@intel.com> --- v2: fixed the format of git log
> examples/vhost/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)|


Applied to dpdk-next-virtio/main with typo fixed.

Thanks,
Maxime


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

end of thread, other threads:[~2021-02-03 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  6:28 [dpdk-dev] [PATCH] examples/vhost: fix potentially overflowing expression Cheng Jiang
2021-02-02  7:24 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
2021-02-03  9:54   ` Maxime Coquelin
2021-02-03 17:20   ` Maxime Coquelin

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