patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: do not use a possibly NULL Pointer
@ 2021-05-24  9:01 Thierry Herbelot
  2021-05-25 14:01 ` [dpdk-stable] [dpdk-dev] " Bing Zhao
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Herbelot @ 2021-05-24  9:01 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable, Ori Kam

Use out only after it was checked not to be NULL.

Fixes: 4d07cbefe3ba0 ("app/testpmd: add commands for conntrack")
Cc: stable@dpdk.org
Cc: Ori Kam <orika@nvidia.com>

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 app/test-pmd/cmdline_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 1c587bb7b803..7645b3cc90a1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -6631,10 +6631,10 @@ parse_vc_action_conntrack_update(struct context *ctx, const struct token *token,
 	/* Token name must match. */
 	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
 		return -1;
-	ct_modify = (struct rte_flow_modify_conntrack *)out->args.vc.data;
 	/* Nothing else to do if there is no buffer. */
 	if (!out)
 		return len;
+	ct_modify = (struct rte_flow_modify_conntrack *)out->args.vc.data;
 	if (ctx->curr == ACTION_CONNTRACK_UPDATE_DIR) {
 		ct_modify->new_ct.is_original_dir =
 				conntrack_context.is_original_dir;
-- 
2.29.2


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: do not use a possibly NULL Pointer
  2021-05-24  9:01 [dpdk-stable] [PATCH] app/testpmd: do not use a possibly NULL Pointer Thierry Herbelot
@ 2021-05-25 14:01 ` Bing Zhao
  0 siblings, 0 replies; 2+ messages in thread
From: Bing Zhao @ 2021-05-25 14:01 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: NBU-Contact-Thomas Monjalon, stable, Ori Kam

Hi Thierry,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Thierry Herbelot
> Sent: Monday, May 24, 2021 5:02 PM
> To: dev@dpdk.org
> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; NBU-Contact-
> Thomas Monjalon <thomas@monjalon.net>; stable@dpdk.org; Ori Kam
> <orika@nvidia.com>
> Subject: [dpdk-dev] [PATCH] app/testpmd: do not use a possibly NULL
> Pointer
> 
> External email: Use caution opening links or attachments
> 
> 
> Use out only after it was checked not to be NULL.
> 
> Fixes: 4d07cbefe3ba0 ("app/testpmd: add commands for conntrack")
> Cc: stable@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> ---
>  app/test-pmd/cmdline_flow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-
> pmd/cmdline_flow.c
> index 1c587bb7b803..7645b3cc90a1 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -6631,10 +6631,10 @@ parse_vc_action_conntrack_update(struct
> context *ctx, const struct token *token,
>         /* Token name must match. */
>         if (parse_default(ctx, token, str, len, NULL, 0) < 0)
>                 return -1;
> -       ct_modify = (struct rte_flow_modify_conntrack *)out-
> >args.vc.data;
>         /* Nothing else to do if there is no buffer. */
>         if (!out)
>                 return len;
> +       ct_modify = (struct rte_flow_modify_conntrack *)out-
> >args.vc.data;

Thanks.
Will there be a segment fault if an auto-completion is done by using "tab"?

>         if (ctx->curr == ACTION_CONNTRACK_UPDATE_DIR) {
>                 ct_modify->new_ct.is_original_dir =
>                                 conntrack_context.is_original_dir;
> --
> 2.29.2

Reviewed-by: Bing Zhao <bingz@nvidia.com>

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

end of thread, other threads:[~2021-05-25 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  9:01 [dpdk-stable] [PATCH] app/testpmd: do not use a possibly NULL Pointer Thierry Herbelot
2021-05-25 14:01 ` [dpdk-stable] [dpdk-dev] " Bing Zhao

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