[v2] app/testpmd: fix return value in portlist parser

Message ID 1582213402-18941-1-git-send-email-hariprasad.govindharajan@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] app/testpmd: fix return value in portlist parser |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed

Commit Message

Hariprasad Govindharajan Feb. 20, 2020, 3:43 p.m. UTC
  The function parse_port_list() is designed to return
unsigned int value. After sanitizing the inputs,
it is returning -1. Changed it to return 0.

Fixes: 2df00d562d20 ("app/testpmd: add --portlist option")
Cc: hariprasad.govindharajan@intel.com

Signed-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>
---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Hariprasad Govindharajan Feb. 20, 2020, 3:46 p.m. UTC | #1
> -----Original Message-----
> From: Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com>
> Sent: Thursday, February 20, 2020 3:43 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>;
> stephen@networkplumber.org; david.marchand@redhat.com;
> Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com>
> Subject: [PATCH v2] app/testpmd: fix return value in portlist parser
> 
> The function parse_port_list() is designed to return unsigned int value. After
> sanitizing the inputs, it is returning -1. Changed it to return 0.
> 
> Fixes: 2df00d562d20 ("app/testpmd: add --portlist option")
> Cc: hariprasad.govindharajan@intel.com
> 
> Signed-off-by: Hariprasad Govindharajan
> <hariprasad.govindharajan@intel.com>
> ---
>  app/test-pmd/config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> 9d95202..91db508 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -2642,7 +2642,7 @@ parse_port_list(const char *list, unsigned int
> *values, unsigned int maxsize)
>  	unsigned int marked[maxsize];
> 
>  	if (list == NULL || values == NULL)
> -		return -1;
> +		return 0;
> 
>  	for (i = 0; i < (int)maxsize; i++)
>  		marked[i] = 0;
> --
> 2.7.4

This patch was acked previously by Bernard Iremonger.
Just changed the patch head line to correct format.

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  
Ferruh Yigit Feb. 20, 2020, 5:01 p.m. UTC | #2
On 2/20/2020 3:43 PM, Hariprasad Govindharajan wrote:
> The function parse_port_list() is designed to return
> unsigned int value. After sanitizing the inputs,
> it is returning -1. Changed it to return 0.
> 
> Fixes: 2df00d562d20 ("app/testpmd: add --portlist option")
> Cc: hariprasad.govindharajan@intel.com
> 
> Signed-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>
> ---
>  app/test-pmd/config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 9d95202..91db508 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -2642,7 +2642,7 @@ parse_port_list(const char *list, unsigned int *values, unsigned int maxsize)
>  	unsigned int marked[maxsize];
>  
>  	if (list == NULL || values == NULL)
> -		return -1;
> +		return 0;

Can you please clarify what is the expected return value on error in the
function comment?

>  
>  	for (i = 0; i < (int)maxsize; i++)
>  		marked[i] = 0;
>
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 9d95202..91db508 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2642,7 +2642,7 @@  parse_port_list(const char *list, unsigned int *values, unsigned int maxsize)
 	unsigned int marked[maxsize];
 
 	if (list == NULL || values == NULL)
-		return -1;
+		return 0;
 
 	for (i = 0; i < (int)maxsize; i++)
 		marked[i] = 0;