event/octeontx: fix memory corruption

Message ID 1589541684-23246-1-git-send-email-hkalra@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series event/octeontx: fix memory corruption |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot warning Travis build: failed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Harman Kalra May 15, 2020, 11:21 a.m. UTC
  Since PMD enqueues a single event at a time, fixing the issue by
passing 1 rather than nb_events to avoid any out of bound access as
reported by coverity.

Coverity issue: 358447
Fixes: 56a96aa42464 ("event/octeontx: add framework for Rx/Tx offloads")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/event/octeontx/ssovf_worker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Jerin Jacob May 15, 2020, 2:36 p.m. UTC | #1
On Fri, May 15, 2020 at 4:51 PM Harman Kalra <hkalra@marvell.com> wrote:
>
> Since PMD enqueues a single event at a time, fixing the issue by
> passing 1 rather than nb_events to avoid any out of bound access as
> reported by coverity.
>
> Coverity issue: 358447
> Fixes: 56a96aa42464 ("event/octeontx: add framework for Rx/Tx offloads")
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-eventdev/master. Thanks.


> ---
>  drivers/event/octeontx/ssovf_worker.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
> index d2d5eea8f..18b7926e8 100644
> --- a/drivers/event/octeontx/ssovf_worker.c
> +++ b/drivers/event/octeontx/ssovf_worker.c
> @@ -282,6 +282,7 @@ __sso_event_tx_adapter_enqueue(void *port, struct rte_event ev[],
>         struct ssows *ws = port;
>         struct octeontx_txq *txq;
>
> +       RTE_SET_USED(nb_events);
>         switch (ev->sched_type) {
>         case SSO_SYNC_ORDERED:
>                 ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
> @@ -305,7 +306,7 @@ __sso_event_tx_adapter_enqueue(void *port, struct rte_event ev[],
>         ethdev = &rte_eth_devices[port_id];
>         txq = ethdev->data->tx_queues[queue_id];
>
> -       return __octeontx_xmit_pkts(txq, &m, nb_events, cmd, flag);
> +       return __octeontx_xmit_pkts(txq, &m, 1, cmd, flag);
>  }
>
>  #define T(name, f3, f2, f1, f0, sz, flags)                                  \
> --
> 2.18.0
>
  

Patch

diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c
index d2d5eea8f..18b7926e8 100644
--- a/drivers/event/octeontx/ssovf_worker.c
+++ b/drivers/event/octeontx/ssovf_worker.c
@@ -282,6 +282,7 @@  __sso_event_tx_adapter_enqueue(void *port, struct rte_event ev[],
 	struct ssows *ws = port;
 	struct octeontx_txq *txq;
 
+	RTE_SET_USED(nb_events);
 	switch (ev->sched_type) {
 	case SSO_SYNC_ORDERED:
 		ssows_swtag_norm(ws, ev->event, SSO_SYNC_ATOMIC);
@@ -305,7 +306,7 @@  __sso_event_tx_adapter_enqueue(void *port, struct rte_event ev[],
 	ethdev = &rte_eth_devices[port_id];
 	txq = ethdev->data->tx_queues[queue_id];
 
-	return __octeontx_xmit_pkts(txq, &m, nb_events, cmd, flag);
+	return __octeontx_xmit_pkts(txq, &m, 1, cmd, flag);
 }
 
 #define T(name, f3, f2, f1, f0, sz, flags)				     \