From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, haifeil@nvidia.com,
Aman Singh <aman.deep.singh@intel.com>,
Matan Azrad <matan@nvidia.com>
Subject: Re: [PATCH v2 08/10] app/test-pmd: remove redundant condition
Date: Thu, 14 Nov 2024 11:27:34 -0800 [thread overview]
Message-ID: <CACZ4nhtuGy9B=GXVEKwRz90geNW-54Oeh9oTEUyWQSqWPQ=utA@mail.gmail.com> (raw)
In-Reply-To: <20241114192603.41145-9-stephen@networkplumber.org>
[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]
On Thu, Nov 14, 2024 at 11:26 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The loop over policy actions will always exit when it sees
> the flow end action, so the next check is redundant.
>
> Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
>
> Fixes: f29fa2c59b85 ("app/testpmd: support policy actions per color")
> Cc: haifeil@nvidia.com
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> app/test-pmd/config.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 88770b4dfc..32c4e86c84 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -2288,7 +2288,7 @@ port_meter_policy_add(portid_t port_id, uint32_t policy_id,
> for (act_n = 0, start = act;
> act->type != RTE_FLOW_ACTION_TYPE_END; act++)
> act_n++;
> - if (act_n && act->type == RTE_FLOW_ACTION_TYPE_END)
> + if (act_n > 0)
> policy.actions[i] = start;
> else
> policy.actions[i] = NULL;
> @@ -7316,4 +7316,3 @@ show_mcast_macs(portid_t port_id)
> printf(" %s\n", buf);
> }
> }
> -
> --
> 2.45.2
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
next prev parent reply other threads:[~2024-11-14 19:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 0:12 [RFC 00/10] unit test bugs Stephen Hemminger
2024-11-14 0:12 ` [RFC 01/10] app/test: do not duplicate loop variable Stephen Hemminger
2024-11-14 0:12 ` [RFC 02/10] app/test: fix typo in mac address compare Stephen Hemminger
2024-11-14 0:12 ` [RFC 03/10] app/test: fix paren typo Stephen Hemminger
2024-11-14 0:12 ` [RFC 04/10] app/test: avoid duplicate initialization Stephen Hemminger
2024-11-14 0:12 ` [RFC 05/10] app/test: fix TLS zero length record Stephen Hemminger
2024-11-14 0:12 ` [RFC 06/10] test/eal: fix core check in c flag test Stephen Hemminger
2024-11-14 0:12 ` [RFC 07/10] app/test-pmd: remove redundant condition Stephen Hemminger
2024-11-14 0:12 ` [RFC 08/10] app/test-pmd: avoid potential outside of array reference Stephen Hemminger
2024-11-14 0:12 ` [RFC 09/10] app/test-dma-perf: fix parsing of dma address Stephen Hemminger
2024-11-14 7:00 ` Morten Brørup
2024-11-14 16:21 ` Stephen Hemminger
2024-11-14 0:12 ` [RFC 10/10] app/test: fix operator precedence bug Stephen Hemminger
2024-11-14 19:24 ` [PATCH v2 00/10] Bug fixes for unit tests Stephen Hemminger
2024-11-14 19:24 ` [PATCH v2 01/10] app/test: do not duplicated loop variable Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 02/10] app/test: fix typo in address compare Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 03/10] app/test: fix paren typo Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 04/10] app/test: avoid duplicate initialization Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 05/10] app/test: fix TLS zero length record Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 06/10] app/test: fix operator precedence bug Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 07/10] test/eal: fix core check in c flag test Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 08/10] app/test-pmd: remove redundant condition Stephen Hemminger
2024-11-14 19:27 ` Ajit Khaparde [this message]
2024-11-14 19:25 ` [PATCH v2 09/10] app/test-pmd: avoid potential outside of array reference Stephen Hemminger
2024-11-14 19:25 ` [PATCH v2 10/10] app/test-dma-perf: fix parsing of DMA address Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACZ4nhtuGy9B=GXVEKwRz90geNW-54Oeh9oTEUyWQSqWPQ=utA@mail.gmail.com' \
--to=ajit.khaparde@broadcom.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=haifeil@nvidia.com \
--cc=matan@nvidia.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).