[dpdk-dev] net/i40e: fix unchecked return in parse devarg

Message ID 1518095892-61961-1-git-send-email-beilei.xing@intel.com
State Accepted, archived
Delegated to: Helin Zhang
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Beilei Xing Feb. 8, 2018, 1:18 p.m.
This patch fixes the coverity CHECKED_RETURN issue.

Coverity issue: 261779
Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Wu, Jingjing Feb. 8, 2018, 1:38 p.m. | #1
> -----Original Message-----
> From: Xing, Beilei
> Sent: Thursday, February 8, 2018 9:18 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Subject: [PATCH] net/i40e: fix unchecked return in parse devarg
> 
> This patch fixes the coverity CHECKED_RETURN issue.
> 
> Coverity issue: 261779
> Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")
> 
> Reported-by: John McNamara <john.mcnamara@intel.com>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 65a4b7a..508b417 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1107,8 +1107,12 @@ i40e_support_multi_driver(struct rte_eth_dev *dev)
>  			    "the first invalid or last valid one is used !",
>  			    ETH_I40E_SUPPORT_MULTI_DRIVER);
> 
> -	rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
> -			   i40e_parse_multi_drv_handler, pf);
> +	if (rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
> +			       i40e_parse_multi_drv_handler, pf) < 0) {
> +		rte_kvargs_free(kvlist);
> +		return -EINVAL;
> +	}
> +
>  	rte_kvargs_free(kvlist);
>  	return 0;
>  }
> --
> 2.5.5
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Helin Zhang Feb. 8, 2018, 1:40 p.m. | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Beilei Xing
> Sent: Thursday, February 8, 2018 9:18 PM
> To: Wu, Jingjing; dev@dpdk.org; Zhang, Qi Z
> Subject: [dpdk-dev] [PATCH] net/i40e: fix unchecked return in parse devarg
> 
> This patch fixes the coverity CHECKED_RETURN issue.
> 
> Coverity issue: 261779
> Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")
> 
> Reported-by: John McNamara <john.mcnamara@intel.com>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Helin Zhang Feb. 8, 2018, 1:44 p.m. | #3
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wu, Jingjing
> Sent: Thursday, February 8, 2018 9:39 PM
> To: Xing, Beilei; dev@dpdk.org; Zhang, Qi Z
> Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix unchecked return in parse devarg
> 
> 
> 
> > -----Original Message-----
> > From: Xing, Beilei
> > Sent: Thursday, February 8, 2018 9:18 PM
> > To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Subject: [PATCH] net/i40e: fix unchecked return in parse devarg
> >
> > This patch fixes the coverity CHECKED_RETURN issue.
> >
> > Coverity issue: 261779
> > Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")
> >
> > Reported-by: John McNamara <john.mcnamara@intel.com>
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 65a4b7a..508b417 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -1107,8 +1107,12 @@ i40e_support_multi_driver(struct rte_eth_dev
> *dev)
> >  			    "the first invalid or last valid one is used !",
> >  			    ETH_I40E_SUPPORT_MULTI_DRIVER);
> >
> > -	rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
> > -			   i40e_parse_multi_drv_handler, pf);
> > +	if (rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
> > +			       i40e_parse_multi_drv_handler, pf) < 0) {
> > +		rte_kvargs_free(kvlist);
> > +		return -EINVAL;
> > +	}
> > +
> >  	rte_kvargs_free(kvlist);
> >  	return 0;
> >  }
> > --
> > 2.5.5
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Applied to dpdk-next-net-intel. Thanks!

/Helin

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 65a4b7a..508b417 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1107,8 +1107,12 @@  i40e_support_multi_driver(struct rte_eth_dev *dev)
 			    "the first invalid or last valid one is used !",
 			    ETH_I40E_SUPPORT_MULTI_DRIVER);
 
-	rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
-			   i40e_parse_multi_drv_handler, pf);
+	if (rte_kvargs_process(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER,
+			       i40e_parse_multi_drv_handler, pf) < 0) {
+		rte_kvargs_free(kvlist);
+		return -EINVAL;
+	}
+
 	rte_kvargs_free(kvlist);
 	return 0;
 }