* [dpdk-stable] [PATCH] net/enic: fix completion pointer calculation
@ 2021-04-12 19:03 John Daley
2021-04-12 20:50 ` [dpdk-stable] [PATCH v1] " John Daley
0 siblings, 1 reply; 3+ messages in thread
From: John Daley @ 2021-04-12 19:03 UTC (permalink / raw)
To: ferruh.yigit, arybchenko; +Cc: dev, John Daley, stable, Hyong Youb Kim
The completion queue index could be implicitly extended past its
uint16_t size when multiplied by the size of the descriptor. While
this should not be a problem, coverity flags it. Do the extention
explicitly by casting the index to uintptr_t.
Coverity issue: 161317
Fixes: 8b428cb5a92e ("net/enic: use 64B completion queue entries if available")
Cc: stable@dpdk.org
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
---
drivers/net/enic/enic_rxtx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index a2a02227e3..3899907d6d 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -70,7 +70,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts,
cq = &enic->cq[enic_cq_rq(enic, sop_rq->index)];
cq_idx = cq->to_clean; /* index of cqd, rqd, mbuf_table */
cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) +
- cq_idx * desc_size);
+ (uintptr_t)cq_idx * desc_size);
color = cq->last_color;
data_rq = &enic->rq[sop_rq->data_queue_idx];
@@ -126,7 +126,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts,
/* Prefetch next mbuf & desc while processing current one */
cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) +
- cq_idx * desc_size);
+ (uintptr_t)cq_idx * desc_size);
rte_enic_prefetch(cqd_ptr);
ciflags = enic_cq_rx_desc_ciflags(
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH v1] net/enic: fix completion pointer calculation
2021-04-12 19:03 [dpdk-stable] [PATCH] net/enic: fix completion pointer calculation John Daley
@ 2021-04-12 20:50 ` John Daley
2021-04-13 10:36 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: John Daley @ 2021-04-12 20:50 UTC (permalink / raw)
To: ferruh.yigit, arybchenko; +Cc: dev, John Daley, stable, Hyong Youb Kim
The completion queue index could be implicitly extended past its
uint16_t size when multiplied by the size of the descriptor. While
this should not be a problem, coverity flags it. Do the extension
explicitly by casting the index to uintptr_t.
Coverity issue: 161317
Fixes: 8b428cb5a92e ("net/enic: use 64B completion queue entries if available")
Cc: stable@dpdk.org
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
---
v1: fix typo
drivers/net/enic/enic_rxtx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index a2a02227e3..3899907d6d 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -70,7 +70,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts,
cq = &enic->cq[enic_cq_rq(enic, sop_rq->index)];
cq_idx = cq->to_clean; /* index of cqd, rqd, mbuf_table */
cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) +
- cq_idx * desc_size);
+ (uintptr_t)cq_idx * desc_size);
color = cq->last_color;
data_rq = &enic->rq[sop_rq->data_queue_idx];
@@ -126,7 +126,7 @@ enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts,
/* Prefetch next mbuf & desc while processing current one */
cqd_ptr = (struct cq_desc *)((uintptr_t)(cq->ring.descs) +
- cq_idx * desc_size);
+ (uintptr_t)cq_idx * desc_size);
rte_enic_prefetch(cqd_ptr);
ciflags = enic_cq_rx_desc_ciflags(
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH v1] net/enic: fix completion pointer calculation
2021-04-12 20:50 ` [dpdk-stable] [PATCH v1] " John Daley
@ 2021-04-13 10:36 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2021-04-13 10:36 UTC (permalink / raw)
To: John Daley, arybchenko; +Cc: dev, stable, Hyong Youb Kim
On 4/12/2021 9:50 PM, John Daley wrote:
> The completion queue index could be implicitly extended past its
> uint16_t size when multiplied by the size of the descriptor. While
> this should not be a problem, coverity flags it. Do the extension
> explicitly by casting the index to uintptr_t.
>
> Coverity issue: 161317
> Fixes: 8b428cb5a92e ("net/enic: use 64B completion queue entries if available")
> Cc: stable@dpdk.org
>
> Signed-off-by: John Daley <johndale@cisco.com>
> Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-13 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 19:03 [dpdk-stable] [PATCH] net/enic: fix completion pointer calculation John Daley
2021-04-12 20:50 ` [dpdk-stable] [PATCH v1] " John Daley
2021-04-13 10:36 ` Ferruh Yigit
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).