From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 36C7142EDA;
	Fri, 21 Jul 2023 14:51:16 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C07E540E2D;
	Fri, 21 Jul 2023 14:51:15 +0200 (CEST)
Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com
 [209.85.221.171])
 by mails.dpdk.org (Postfix) with ESMTP id 3440E40DDC
 for <dev@dpdk.org>; Fri, 21 Jul 2023 14:51:15 +0200 (CEST)
Received: by mail-vk1-f171.google.com with SMTP id
 71dfb90a1353d-483a629c3a3so1340472e0c.0
 for <dev@dpdk.org>; Fri, 21 Jul 2023 05:51:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1689943874; x=1690548674;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YJr1WDDouf9BV8ux700V8u1G6XPyKeLr/RVEn1wvhD0=;
 b=NPP3WrTq+wyy55+zs4nS2hf/9NJDu6/UPaEzJtCV/uFH6UxG/SjET2jcAYlJ5ByB1D
 iqAdjjZkf2G1HJ2RIvSd07UNVB5JAmFwih5ZNgsbkQ8fYR7cy9Banm/hFzH2JmmKor3U
 4NxJPC83J7qroc6XoDHWkBIIrL9/WDuO4eIJ20JHsLkPlT0Dthq0kFbwv5CLzsTPX/MS
 j0Umww7rCjTzqYWwsMd1MYIz7tnhQUaNg5svLXzAPgauSw00xJeWDKtim1E+3DHopYYH
 BrUPAc4qfLXfBBjJ42nhw/q9ECoAM4KZW3tnDD3akfqbZ07b4cb4A/zbKaF6p93O6Bvn
 Od5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1689943874; x=1690548674;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=YJr1WDDouf9BV8ux700V8u1G6XPyKeLr/RVEn1wvhD0=;
 b=LZYk0MKKXxnG56dV1wu65+dkjMypMP0cHQ+udDdKfGuPJo4f6WSOrr1z5ay1RXXkHB
 K+qpZOrQJajDHo8TMXK1OYT2j/bUz/4QvWSPJY3TMHzffcSpld96fnC6r0XdCh5dyLB4
 LRea4D7YU2CMHeNctPsgM2IVXge0UdamJj1zTZ7gIBdZcj9pDv1DyZuas9GHGhv7kAQP
 xHW5yScSjonQdRqWy6qjhR9jWvdB3vz0YgGBDNMbS1mTpLG1NMIsxz6eZKL77hEcpBqQ
 /FCqTGy4CcMIBte/cRQDuFPmvBpTacDnK4nHxhZa+9cjiZaXNmc6ZUJg9NdI6DzdA55C
 QjXg==
X-Gm-Message-State: ABy/qLamROPUeM6ciQzc5pMMblxmU05OUa65Dfl/a77WLPiiRrKQfB/o
 h2FZxsvLc2f4irvGL3hrJ3T1VVx5NjkbLYYAuro=
X-Google-Smtp-Source: APBJJlH8lbwYoNS8gAj4HWTIQdCOJMoSH7G9/bvJ6/eHnk+3vhRclzHEfCgs71zoUcXHvGlDhBmdFXwXroeRM9wee0Q=
X-Received: by 2002:a1f:c186:0:b0:46e:8610:5756 with SMTP id
 r128-20020a1fc186000000b0046e86105756mr560043vkf.8.1689943874338; Fri, 21 Jul
 2023 05:51:14 -0700 (PDT)
MIME-Version: 1.0
References: <20230721021316.1473047-1-zhirun.yan@intel.com>
In-Reply-To: <20230721021316.1473047-1-zhirun.yan@intel.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Fri, 21 Jul 2023 18:20:48 +0530
Message-ID: <CALBAE1PfFnGT_1-LroeTze-LvYc-tCdaswwvMQc=mcCXJv_LTA@mail.gmail.com>
Subject: Re: [PATCH v1] test/graph: fix unused return value
To: Zhirun Yan <zhirun.yan@intel.com>
Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, 
 ndabilpuram@marvell.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Fri, Jul 21, 2023 at 8:12=E2=80=AFAM Zhirun Yan <zhirun.yan@intel.com> w=
rote:
>
> Return value stored in "ret" but it may be overwritten before use.
> Add goto to return when meet an error. Issue reported by coverity scan.
>
> Coverity issue: 395532
> Fixes: 15f483feec65 ("graph: fix model check in core binding")
>
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


> ---
>  app/test/test_graph.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/app/test/test_graph.c b/app/test/test_graph.c
> index af90ac07ec..7995f67757 100644
> --- a/app/test/test_graph.c
> +++ b/app/test/test_graph.c
> @@ -740,13 +740,13 @@ test_graph_model_mcore_dispatch_core_bind_unbind(vo=
id)
>         ret =3D rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH=
);
>         if (ret !=3D 0) {
>                 printf("Set graph mcore dispatch model failed\n");
> -               ret =3D -1;
> +               goto fail;
>         }
>
>         ret =3D rte_graph_model_mcore_dispatch_core_bind(cloned_graph_id,=
 worker_lcore);
>         if (ret !=3D 0) {
>                 printf("bind graph %d to lcore %u failed\n", graph_id, wo=
rker_lcore);
> -               ret =3D -1;
> +               goto fail;
>         }
>
>         graph =3D rte_graph_lookup("worker0-cloned-test2");
> @@ -755,6 +755,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void=
)
>                 printf("bind graph %s(id:%d) with lcore %u failed\n",
>                        graph->name, graph->id, worker_lcore);
>                 ret =3D -1;
> +               goto fail;
>         }
>
>         rte_graph_model_mcore_dispatch_core_unbind(cloned_graph_id);
> @@ -764,6 +765,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void=
)
>                 ret =3D -1;
>         }
>
> +fail:
>         rte_graph_destroy(cloned_graph_id);
>
>         return ret;
> @@ -781,7 +783,7 @@ test_graph_worker_model_set_get(void)
>         ret =3D rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH=
);
>         if (ret !=3D 0) {
>                 printf("Set graph mcore dispatch model failed\n");
> -               ret =3D -1;
> +               goto fail;
>         }
>
>         graph =3D rte_graph_lookup("worker0-cloned-test3");
> @@ -790,9 +792,10 @@ test_graph_worker_model_set_get(void)
>                 ret =3D -1;
>         }
>
> +fail:
>         rte_graph_destroy(cloned_graph_id);
>
> -       return 0;
> +       return ret;
>  }
>
>  static int
> --
> 2.37.2
>