[v3,1/1] app/test-flow-perf: fix division or module by zero

Message ID 20230124103803.1924606-1-mahmad@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3,1/1] app/test-flow-perf: fix division or module by zero |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Mohammad Iqbal Ahmad Jan. 24, 2023, 10:38 a.m. UTC
  Fix division or module by zero reported by coverity scan.
Updated .mailmap

Coverity issue: 373870
Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")

Signed-off-by: Mohammad Iqbal Ahmad <mahmad@marvell.com>
---
 .mailmap                  | 1 +
 app/test-flow-perf/main.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Wisam Monther Feb. 20, 2023, 12:46 p.m. UTC | #1
Hi,


> -----Original Message-----
> From: Mohammad Iqbal Ahmad <mahmad@marvell.com>
> Sent: Tuesday, January 24, 2023 12:38 PM
> To: dev@dpdk.org; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; Wisam Monther <wisamm@nvidia.com>; Jack
> Min <jackmin@nvidia.com>
> Cc: jerinj@marvell.com; skori@marvell.com; skoteshwar@marvell.com;
> pbhagavatula@marvell.com; kirankumark@marvell.com;
> psatheesh@marvell.com; asekhar@marvell.com; anoobj@marvell.com;
> gakhil@marvell.com; hkalra@marvell.com; ndabilpuram@marvell.com;
> Mohammad Iqbal Ahmad <mahmad@marvell.com>
> Subject: [PATCH v3 1/1] app/test-flow-perf: fix division or module by zero
> 
> Fix division or module by zero reported by coverity scan.
> Updated .mailmap
> 
> Coverity issue: 373870
> Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
> 
> Signed-off-by: Mohammad Iqbal Ahmad <mahmad@marvell.com>
> ---
>  .mailmap                  | 1 +
>  app/test-flow-perf/main.c | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/.mailmap b/.mailmap
> index a153c9ab93..ec9f419f53 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -912,6 +912,7 @@ Mitch Williams <mitch.a.williams@intel.com>  Mit
> Matelske <mit@pt.net>  Mohamad Noor Alim Hussin
> <mohamad.noor.alim.hussin@intel.com>
>  Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
> +Mohammad Iqbal Ahmad <mahmad@marvell.com>

Why you added such change in flow-perf related patch?

>  Mohammed Gamal <mgamal@redhat.com>
>  Mohsin Kazmi <mohsin.kazmi14@gmail.com>  Mohsin Mazhar Shaikh
> <mohsinmazhar_shaikh@trendmicro.com>
> diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index
> 4a9206803a..0a542b0d87 100644
> --- a/app/test-flow-perf/main.c
> +++ b/app/test-flow-perf/main.c

BRs,
Wisam Jaddo
  
Thomas Monjalon Feb. 20, 2023, 12:51 p.m. UTC | #2
20/02/2023 13:46, Wisam Monther:
> > --- a/.mailmap
> > +++ b/.mailmap
> > @@ -912,6 +912,7 @@ Mitch Williams <mitch.a.williams@intel.com>  Mit
> > Matelske <mit@pt.net>  Mohamad Noor Alim Hussin
> > <mohamad.noor.alim.hussin@intel.com>
> >  Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
> > +Mohammad Iqbal Ahmad <mahmad@marvell.com>
> 
> Why you added such change in flow-perf related patch?

That's because when it is your first patch, your name must be added.
It is a new file. New rule :)
  
Wisam Monther March 6, 2023, 10:21 a.m. UTC | #3
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, February 20, 2023 2:52 PM
> To: Mohammad Iqbal Ahmad <mahmad@marvell.com>; dev@dpdk.org; Jack
> Min <jackmin@nvidia.com>; Wisam Monther <wisamm@nvidia.com>
> Cc: jerinj@marvell.com; skori@marvell.com; skoteshwar@marvell.com;
> pbhagavatula@marvell.com; kirankumark@marvell.com;
> psatheesh@marvell.com; asekhar@marvell.com; anoobj@marvell.com;
> gakhil@marvell.com; hkalra@marvell.com; ndabilpuram@marvell.com
> Subject: Re: [PATCH v3 1/1] app/test-flow-perf: fix division or module by
> zero
> 
> 20/02/2023 13:46, Wisam Monther:
> > > --- a/.mailmap
> > > +++ b/.mailmap
> > > @@ -912,6 +912,7 @@ Mitch Williams <mitch.a.williams@intel.com>  Mit
> > > Matelske <mit@pt.net>  Mohamad Noor Alim Hussin
> > > <mohamad.noor.alim.hussin@intel.com>
> > >  Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
> > > +Mohammad Iqbal Ahmad <mahmad@marvell.com>
> >
> > Why you added such change in flow-perf related patch?
> 
> That's because when it is your first patch, your name must be added.
> It is a new file. New rule :)

Sorry, first time hearing this 😊

> Subject: [PATCH v3 1/1] app/test-flow-perf: fix division or module by zero
> 
> Fix division or module by zero reported by coverity scan.
> Updated .mailmap
> 
> Coverity issue: 373870
> Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
> 
> Signed-off-by: Mohammad Iqbal Ahmad <mahmad@marvell.com>

Acked-by: Wisam Jaddo <wisamm@nvidia.com>
  
Thomas Monjalon March 12, 2023, 2:05 p.m. UTC | #4
24/01/2023 11:38, Mohammad Iqbal Ahmad:
> Fix division or module by zero reported by coverity scan.
> Updated .mailmap
> 
> Coverity issue: 373870
> Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
> 
> Signed-off-by: Mohammad Iqbal Ahmad <mahmad@marvell.com>
> ---
>  			if (strcmp(lgopts[opt_idx].name,
>  					"rules-batch") == 0) {
> -				rules_batch = atoi(optarg);
> +				n = atoi(optarg);
> +				if (n > 0)
> +					rules_batch = n;
> +				else
> +					rte_exit(EXIT_FAILURE,
> +							"flow rules_batch should be > 0\n");

The option name is rules-batch (with a hyphen). Will fix while merging.

Applied, thanks.
  

Patch

diff --git a/.mailmap b/.mailmap
index a153c9ab93..ec9f419f53 100644
--- a/.mailmap
+++ b/.mailmap
@@ -912,6 +912,7 @@  Mitch Williams <mitch.a.williams@intel.com>
 Mit Matelske <mit@pt.net>
 Mohamad Noor Alim Hussin <mohamad.noor.alim.hussin@intel.com>
 Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
+Mohammad Iqbal Ahmad <mahmad@marvell.com>
 Mohammed Gamal <mgamal@redhat.com>
 Mohsin Kazmi <mohsin.kazmi14@gmail.com>
 Mohsin Mazhar Shaikh <mohsinmazhar_shaikh@trendmicro.com>
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 4a9206803a..0a542b0d87 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -848,7 +848,12 @@  args_parse(int argc, char **argv)
 			/* Control */
 			if (strcmp(lgopts[opt_idx].name,
 					"rules-batch") == 0) {
-				rules_batch = atoi(optarg);
+				n = atoi(optarg);
+				if (n > 0)
+					rules_batch = n;
+				else
+					rte_exit(EXIT_FAILURE,
+							"flow rules_batch should be > 0\n");
 			}
 			if (strcmp(lgopts[opt_idx].name,
 					"rules-count") == 0) {