DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH 3/5] net/mlx4: fix possible uninitialized variable
Date: Fri, 16 Nov 2018 17:58:52 +0100	[thread overview]
Message-ID: <20181116165854.24017-4-thomas@monjalon.net> (raw)
In-Reply-To: <20181116165854.24017-1-thomas@monjalon.net>

When compiling with gcc -O1, this error appears:
	drivers/net/mlx4/mlx4_ethdev.c: In function ‘mlx4_rxmode_toggle’:
	rte_log.h:321:3: error:
	‘mode’ may be used uninitialized in this function

The function mlx4_rxmode_toggle is never called with a value which
is not in the switch block, but GCC complains about it with -O1.
So the default case is "fixed" by setting string "undefined".

Fixes: eacaac7bae36 ("net/mlx4: restore promisc and allmulti support")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/mlx4/mlx4_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 30deb3ef0..195a1b6df 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -360,6 +360,8 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 		mode = "all multicast";
 		dev->data->all_multicast = toggle & 1;
 		break;
+	default:
+		mode = "undefined";
 	}
 	if (!mlx4_flow_sync(priv, &error))
 		return;
-- 
2.19.0

  parent reply	other threads:[~2018-11-16 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 1/5] eal: fix build with -O1 Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 2/5] kni: fix possible uninitialized variable Thomas Monjalon
2018-11-16 16:58 ` Thomas Monjalon [this message]
2018-11-16 16:58 ` [dpdk-dev] [PATCH 4/5] eventdev: " Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 5/5] app/eventdev: " Thomas Monjalon
2018-11-23  0:26 ` [dpdk-dev] [PATCH 0/5] fix build with option -O1 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=20181116165854.24017-4-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.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).