From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
jerin.jacob@caviumnetworks.com,
Bruce Richardson <bruce.richardson@intel.com>,
Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Subject: [PATCH v3 04/10] app/test: avoid duplicate initialization
Date: Fri, 15 Nov 2024 12:06:48 -0800 [thread overview]
Message-ID: <20241115200751.17141-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20241115200751.17141-1-stephen@networkplumber.org>
The event_dev_config initialization had duplicate assignments
to the same element. Change to use structure initialization
so that compiler will catch this type of bug.
Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")
Cc: jerin.jacob@caviumnetworks.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/test/test_event_crypto_adapter.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 9d38a66bfa..ab24e30a97 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -1154,21 +1154,17 @@ configure_cryptodev(void)
static inline void
evdev_set_conf_values(struct rte_event_dev_config *dev_conf,
- struct rte_event_dev_info *info)
+ const struct rte_event_dev_info *info)
{
- memset(dev_conf, 0, sizeof(struct rte_event_dev_config));
- dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns;
- dev_conf->nb_event_ports = NB_TEST_PORTS;
- dev_conf->nb_event_queues = NB_TEST_QUEUES;
- dev_conf->nb_event_queue_flows = info->max_event_queue_flows;
- dev_conf->nb_event_port_dequeue_depth =
- info->max_event_port_dequeue_depth;
- dev_conf->nb_event_port_enqueue_depth =
- info->max_event_port_enqueue_depth;
- dev_conf->nb_event_port_enqueue_depth =
- info->max_event_port_enqueue_depth;
- dev_conf->nb_events_limit =
- info->max_num_events;
+ *dev_conf = (struct rte_event_dev_config) {
+ .dequeue_timeout_ns = info->min_dequeue_timeout_ns,
+ .nb_event_ports = NB_TEST_PORTS,
+ .nb_event_queues = NB_TEST_QUEUES,
+ .nb_event_queue_flows = info->max_event_queue_flows,
+ .nb_event_port_dequeue_depth = info->max_event_port_dequeue_depth,
+ .nb_event_port_enqueue_depth = info->max_event_port_enqueue_depth,
+ .nb_events_limit = info->max_num_events,
+ };
}
static int
--
2.45.2
next prev parent reply other threads:[~2024-11-15 20:08 UTC|newest]
Thread overview: 48+ 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-15 7:19 ` fengchengwen
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-15 9:01 ` Bruce Richardson
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-15 9:02 ` Bruce Richardson
2024-11-14 19:25 ` [PATCH v2 04/10] app/test: avoid duplicate initialization Stephen Hemminger
2024-11-15 9:03 ` Bruce Richardson
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-15 9:06 ` Bruce Richardson
2024-11-14 19:25 ` [PATCH v2 07/10] test/eal: fix core check in c flag test Stephen Hemminger
2024-11-15 9:07 ` Bruce Richardson
2024-11-15 19:53 ` 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
2024-11-15 9:08 ` Bruce Richardson
2024-11-14 19:25 ` [PATCH v2 09/10] app/test-pmd: avoid potential outside of array reference Stephen Hemminger
2024-11-15 9:09 ` Bruce Richardson
2024-11-14 19:25 ` [PATCH v2 10/10] app/test-dma-perf: fix parsing of DMA address Stephen Hemminger
2024-11-15 9:13 ` Bruce Richardson
2024-11-15 19:58 ` Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 00/10] bug fixes for unit tests Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 01/10] app/test: do not duplicate loop variable Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 02/10] app/test: fix typo in address compare Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 03/10] app/test: fix paren typo Stephen Hemminger
2024-11-15 20:06 ` Stephen Hemminger [this message]
2024-11-15 20:06 ` [PATCH v3 05/10] app/test: fix TLS zero length record Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 06/10] app/test: fix operator precedence bug Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 07/10] test/eal: fix core check in c flag test Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 08/10] app/test-pmd: remove redundant condition Stephen Hemminger
2024-11-15 20:52 ` Ajit Khaparde
2024-11-15 20:06 ` [PATCH v3 09/10] app/test-pmd: avoid potential outside of array reference Stephen Hemminger
2024-11-15 20:06 ` [PATCH v3 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=20241115200751.17141-5-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=abhinandan.gujjar@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
/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).