patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/bnxt: check return value
@ 2021-03-19  0:17 Ajit Khaparde
  2021-03-19  3:56 ` Ajit Khaparde
  0 siblings, 1 reply; 2+ messages in thread
From: Ajit Khaparde @ 2021-03-19  0:17 UTC (permalink / raw)
  To: dev; +Cc: stable, Lance Richardson

[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]

Check return value of rte_kvargs_process()

Coverity issue: 357765

Fixes: ba404aacc5cf ("net/bnxt: set maximum flow count")
Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
Fixes: 7b0940653720 ("net/bnxt: support host memory based TruFlow")

Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1990d65c29..930e7e83f4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -5477,40 +5477,49 @@ bnxt_parse_devarg_rep_fc_f2r(__rte_unused const char *key,
 	return 0;
 }
 
-static void
+static int
 bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
 {
 	struct rte_kvargs *kvlist;
+	int ret;
 
 	if (devargs == NULL)
-		return;
+		return 0;
 
 	kvlist = rte_kvargs_parse(devargs->args, bnxt_dev_args);
 	if (kvlist == NULL)
-		return;
+		return -EINVAL;
 
 	/*
 	 * Handler for "truflow" devarg.
 	 * Invoked as for ex: "-a 0000:00:0d.0,host-based-truflow=1"
 	 */
-	rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW,
-			   bnxt_parse_devarg_truflow, bp);
+	ret = rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW,
+				 bnxt_parse_devarg_truflow, bp);
+	if (ret)
+		goto err;
 
 	/*
 	 * Handler for "flow_xstat" devarg.
 	 * Invoked as for ex: "-a 0000:00:0d.0,flow_xstat=1"
 	 */
-	rte_kvargs_process(kvlist, BNXT_DEVARG_FLOW_XSTAT,
-			   bnxt_parse_devarg_flow_xstat, bp);
+	ret = rte_kvargs_process(kvlist, BNXT_DEVARG_FLOW_XSTAT,
+				 bnxt_parse_devarg_flow_xstat, bp);
+	if (ret)
+		goto err;
 
 	/*
 	 * Handler for "max_num_kflows" devarg.
 	 * Invoked as for ex: "-a 000:00:0d.0,max_num_kflows=32"
 	 */
-	rte_kvargs_process(kvlist, BNXT_DEVARG_MAX_NUM_KFLOWS,
-			   bnxt_parse_devarg_max_num_kflows, bp);
+	ret = rte_kvargs_process(kvlist, BNXT_DEVARG_MAX_NUM_KFLOWS,
+				 bnxt_parse_devarg_max_num_kflows, bp);
+	if (ret)
+		goto err;
 
+err:
 	rte_kvargs_free(kvlist);
+	return ret;
 }
 
 static int bnxt_alloc_switch_domain(struct bnxt *bp)
@@ -5645,7 +5654,9 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
 	bp = eth_dev->data->dev_private;
 
 	/* Parse dev arguments passed on when starting the DPDK application. */
-	bnxt_parse_dev_args(bp, pci_dev->device.devargs);
+	rc = bnxt_parse_dev_args(bp, pci_dev->device.devargs);
+	if (rc)
+		goto error_free;
 
 	rc = bnxt_drv_init(eth_dev);
 	if (rc)
-- 
2.21.1 (Apple Git-122.3)


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

* Re: [dpdk-stable] [PATCH] net/bnxt: check return value
  2021-03-19  0:17 [dpdk-stable] [PATCH] net/bnxt: check return value Ajit Khaparde
@ 2021-03-19  3:56 ` Ajit Khaparde
  0 siblings, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2021-03-19  3:56 UTC (permalink / raw)
  To: dpdk-dev; +Cc: dpdk stable, Lance Richardson

[-- Attachment #1: Type: text/plain, Size: 3368 bytes --]

On Thu, Mar 18, 2021 at 5:17 PM Ajit Khaparde
<ajit.khaparde@broadcom.com> wrote:
>
> Check return value of rte_kvargs_process()
>
> Coverity issue: 357765
>
> Fixes: ba404aacc5cf ("net/bnxt: set maximum flow count")
> Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
> Fixes: 7b0940653720 ("net/bnxt: support host memory based TruFlow")
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++++++++++++++++----------
>  1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 1990d65c29..930e7e83f4 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -5477,40 +5477,49 @@ bnxt_parse_devarg_rep_fc_f2r(__rte_unused const char *key,
>         return 0;
>  }
>
> -static void
> +static int
>  bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
>  {
>         struct rte_kvargs *kvlist;
> +       int ret;
>
>         if (devargs == NULL)
> -               return;
> +               return 0;
>
>         kvlist = rte_kvargs_parse(devargs->args, bnxt_dev_args);
>         if (kvlist == NULL)
> -               return;
> +               return -EINVAL;
>
>         /*
>          * Handler for "truflow" devarg.
>          * Invoked as for ex: "-a 0000:00:0d.0,host-based-truflow=1"
>          */
> -       rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW,
> -                          bnxt_parse_devarg_truflow, bp);
> +       ret = rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW,
> +                                bnxt_parse_devarg_truflow, bp);
> +       if (ret)
> +               goto err;
>
>         /*
>          * Handler for "flow_xstat" devarg.
>          * Invoked as for ex: "-a 0000:00:0d.0,flow_xstat=1"
>          */
> -       rte_kvargs_process(kvlist, BNXT_DEVARG_FLOW_XSTAT,
> -                          bnxt_parse_devarg_flow_xstat, bp);
> +       ret = rte_kvargs_process(kvlist, BNXT_DEVARG_FLOW_XSTAT,
> +                                bnxt_parse_devarg_flow_xstat, bp);
> +       if (ret)
> +               goto err;
>
>         /*
>          * Handler for "max_num_kflows" devarg.
>          * Invoked as for ex: "-a 000:00:0d.0,max_num_kflows=32"
>          */
> -       rte_kvargs_process(kvlist, BNXT_DEVARG_MAX_NUM_KFLOWS,
> -                          bnxt_parse_devarg_max_num_kflows, bp);
> +       ret = rte_kvargs_process(kvlist, BNXT_DEVARG_MAX_NUM_KFLOWS,
> +                                bnxt_parse_devarg_max_num_kflows, bp);
> +       if (ret)
> +               goto err;
>
> +err:
>         rte_kvargs_free(kvlist);
> +       return ret;
>  }
>
>  static int bnxt_alloc_switch_domain(struct bnxt *bp)
> @@ -5645,7 +5654,9 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
>         bp = eth_dev->data->dev_private;
>
>         /* Parse dev arguments passed on when starting the DPDK application. */
> -       bnxt_parse_dev_args(bp, pci_dev->device.devargs);
> +       rc = bnxt_parse_dev_args(bp, pci_dev->device.devargs);
> +       if (rc)
> +               goto error_free;
>
>         rc = bnxt_drv_init(eth_dev);
>         if (rc)
> --
> 2.21.1 (Apple Git-122.3)
>

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

end of thread, other threads:[~2021-03-19  3:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19  0:17 [dpdk-stable] [PATCH] net/bnxt: check return value Ajit Khaparde
2021-03-19  3:56 ` Ajit Khaparde

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/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 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


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