DPDK website maintenance
 help / color / Atom feed
* [dpdk-web] [PATCH] net/ipn3ke: check input arguement before other operation
@ 2019-05-22  7:04 Andy Pei
  2019-05-23  2:31 ` Xu, Rosen
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Pei @ 2019-05-22  7:04 UTC (permalink / raw)
  To: web; +Cc: andy.pei, rosen.xu, stable

check input arguement rte_eth_dev *ethdev, ensuring ethdev
is not NULl before operation on ethdev.

Coverity issue: 337922
Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")
Cc: rosen.xu@intel.com
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_representor.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index cf3b214..32d4fc8 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -735,13 +735,16 @@
 	enum rte_filter_type filter_type, enum rte_filter_op filter_op,
 	void *arg)
 {
-	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
-	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
 	int ret = 0;
+	struct ipn3ke_hw *hw = NULL;
+	struct ipn3ke_rpst *rpst = NULL;
 
 	if (ethdev == NULL)
 		return -EINVAL;
 
+	hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
+	rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
+
 	if (hw->acc_flow)
 		switch (filter_type) {
 		case RTE_ETH_FILTER_GENERIC:
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-web] [PATCH] net/ipn3ke: check input arguement before other operation
  2019-05-22  7:04 [dpdk-web] [PATCH] net/ipn3ke: check input arguement before other operation Andy Pei
@ 2019-05-23  2:31 ` Xu, Rosen
  0 siblings, 0 replies; 2+ messages in thread
From: Xu, Rosen @ 2019-05-23  2:31 UTC (permalink / raw)
  To: Pei, Andy, web; +Cc: stable



> -----Original Message-----
> From: Pei, Andy
> Sent: Wednesday, May 22, 2019 15:05
> To: web@dpdk.org
> Cc: Pei, Andy <andy.pei@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] net/ipn3ke: check input arguement before other operation
> 
> check input arguement rte_eth_dev *ethdev, ensuring ethdev is not NULl
> before operation on ethdev.
> 
> Coverity issue: 337922
> Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")
> Cc: rosen.xu@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_representor.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c
> b/drivers/net/ipn3ke/ipn3ke_representor.c
> index cf3b214..32d4fc8 100644
> --- a/drivers/net/ipn3ke/ipn3ke_representor.c
> +++ b/drivers/net/ipn3ke/ipn3ke_representor.c
> @@ -735,13 +735,16 @@
>  	enum rte_filter_type filter_type, enum rte_filter_op filter_op,
>  	void *arg)
>  {
> -	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
> -	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
>  	int ret = 0;
> +	struct ipn3ke_hw *hw = NULL;
> +	struct ipn3ke_rpst *rpst = NULL;

No need to initialize point variable.

>  	if (ethdev == NULL)
>  		return -EINVAL;
> 
> +	hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
> +	rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
> +
>  	if (hw->acc_flow)
>  		switch (filter_type) {
>  		case RTE_ETH_FILTER_GENERIC:
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22  7:04 [dpdk-web] [PATCH] net/ipn3ke: check input arguement before other operation Andy Pei
2019-05-23  2:31 ` Xu, Rosen

DPDK website maintenance

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/web/0 web/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 web web/ http://inbox.dpdk.org/web \
		web@dpdk.org
	public-inbox-index web


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.web


AGPL code for this site: git clone https://public-inbox.org/ public-inbox