DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@oss.nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <churchill.khangar@intel.com>,
	<cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH] examples/pipeline: fix build
Date: Mon, 12 Jul 2021 10:46:36 +0300	[thread overview]
Message-ID: <20210712074636.406903-1-alialnu@nvidia.com> (raw)

This patch fixes the following build failures seen on Ubuntu 16.04
with gcc 5.4.0 because of uninitialized variables:
...
examples/pipeline/cli.c:1559:11: error: 'weight_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:1545:13: error: 'member_id_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:1538:12: error: 'group_id_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2189:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2179:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2265:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2248:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2358:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2325:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]

Fixes: 598fe0dd0d8e ("examples/pipeline: support selector table")
Cc: cristian.dumitrescu@intel.com

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---
 examples/pipeline/cli.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index f67783c8fa..bf32efa212 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -1491,7 +1491,7 @@ pipeline_selector_group_member_read(const char *string,
 {
 	char *token_array[GROUP_MEMBER_INFO_TOKENS_MAX], **tokens;
 	char *s0 = NULL, *s;
-	uint32_t n_tokens = 0, group_id_val, member_id_val, weight_val;
+	uint32_t n_tokens = 0, group_id_val = 0, member_id_val = 0, weight_val = 0;
 	int blank_or_comment = 0;
 
 	/* Check input arguments. */
@@ -2141,7 +2141,7 @@ cmd_pipeline_meter_reset(char **tokens,
 {
 	struct pipeline *p;
 	const char *name;
-	uint32_t idx0, idx1;
+	uint32_t idx0 = 0, idx1 = 0;
 
 	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
@@ -2210,7 +2210,7 @@ cmd_pipeline_meter_set(char **tokens,
 {
 	struct pipeline *p;
 	const char *name, *profile_name;
-	uint32_t idx0, idx1;
+	uint32_t idx0 = 0, idx1 = 0;
 
 	if (n_tokens != 11) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
@@ -2287,7 +2287,7 @@ cmd_pipeline_meter_stats(char **tokens,
 	struct rte_swx_ctl_meter_stats stats;
 	struct pipeline *p;
 	const char *name;
-	uint32_t idx0, idx1;
+	uint32_t idx0 = 0, idx1 = 0;
 
 	if (n_tokens != 9) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
-- 
2.25.1


             reply	other threads:[~2021-07-12  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12  7:46 Ali Alnubani [this message]
2021-07-12  8:08 ` Dumitrescu, Cristian
2021-07-20 10:04   ` Thomas Monjalon

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=20210712074636.406903-1-alialnu@nvidia.com \
    --to=alialnu@oss.nvidia.com \
    --cc=churchill.khangar@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).