diff mbox series

app/eventdev: fix segfault with incorrect timer adadpters

Message ID 20201112174330.313-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series app/eventdev: fix segfault with incorrect timer adadpters | expand

Checks

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

Commit Message

Pavan Nikhilesh Bhagavatula Nov. 12, 2020, 5:43 p.m. UTC
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Fix SEGFAULT when nb_timer_adapters command line parameter is
set to 0.

Fixes: 98c6292105d4 ("app/eventdev: add options for event timer adapter")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test-eventdev/evt_options.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jerin Jacob Nov. 13, 2020, 9:56 a.m. UTC | #1
On Thu, Nov 12, 2020 at 11:13 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Fix SEGFAULT when nb_timer_adapters command line parameter is
> set to 0.
>
> Fixes: 98c6292105d4 ("app/eventdev: add options for event timer adapter")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

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



> ---
>  app/test-eventdev/evt_options.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
> index 6994ac453..6aeab8257 100644
> --- a/app/test-eventdev/evt_options.c
> +++ b/app/test-eventdev/evt_options.c
> @@ -197,6 +197,10 @@ evt_parse_nb_timer_adptrs(struct evt_options *opt, const char *arg)
>         int ret;
>
>         ret = parser_read_uint8(&(opt->nb_timer_adptrs), arg);
> +       if (opt->nb_timer_adptrs <= 0) {
> +               evt_err("Number of timer adapters cant be <= 0");
> +               return -EINVAL;
> +       }
>
>         return ret;
>  }
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 6994ac453..6aeab8257 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -197,6 +197,10 @@  evt_parse_nb_timer_adptrs(struct evt_options *opt, const char *arg)
 	int ret;
 
 	ret = parser_read_uint8(&(opt->nb_timer_adptrs), arg);
+	if (opt->nb_timer_adptrs <= 0) {
+		evt_err("Number of timer adapters cant be <= 0");
+		return -EINVAL;
+	}
 
 	return ret;
 }