netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roopa Prabhu <roopa@nvidia.com>
To: <davem@davemloft.net>, <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <stephen@networkplumber.org>,
	<nikolay@cumulusnetworks.com>, <idosch@nvidia.com>,
	<dsahern@gmail.com>, <bpoirier@nvidia.com>
Subject: [PATCH net-next v3 02/12] vxlan_core: fix build warnings in vxlan_xmit_one
Date: Tue, 1 Mar 2022 05:04:29 +0000	[thread overview]
Message-ID: <20220301050439.31785-3-roopa@nvidia.com> (raw)
In-Reply-To: <20220301050439.31785-1-roopa@nvidia.com>

Fix the below build warnings reported by kernel test robot:
   - initialize vni in vxlan_xmit_one
   - wrap label in ipv6 enabled checks in vxlan_xmit_one

warnings:
static
   drivers/net/vxlan/vxlan_core.c:2437:14: warning: variable 'label' set
but not used [-Wunused-but-set-variable]
           __be32 vni, label;
                       ^

>> drivers/net/vxlan/vxlan_core.c:2483:7: warning: variable 'vni' is
used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
---
 drivers/net/vxlan/vxlan_core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index d0dc90d3dac2..a852582e6615 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -2603,13 +2603,16 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 	struct vxlan_metadata *md = &_md;
 	__be16 src_port = 0, dst_port;
 	struct dst_entry *ndst = NULL;
-	__be32 vni, label;
 	__u8 tos, ttl;
 	int ifindex;
 	int err;
 	u32 flags = vxlan->cfg.flags;
 	bool udp_sum = false;
 	bool xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
+	__be32 vni = 0;
+#if IS_ENABLED(CONFIG_IPV6)
+	__be32 label;
+#endif
 
 	info = skb_tunnel_info(skb);
 
@@ -2647,7 +2650,9 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 			udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM_TX);
 		else
 			udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
+#if IS_ENABLED(CONFIG_IPV6)
 		label = vxlan->cfg.label;
+#endif
 	} else {
 		if (!info) {
 			WARN_ONCE(1, "%s: Missing encapsulation instructions\n",
@@ -2674,7 +2679,9 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		}
 		ttl = info->key.ttl;
 		tos = info->key.tos;
+#if IS_ENABLED(CONFIG_IPV6)
 		label = info->key.label;
+#endif
 		udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
 	}
 	src_port = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
-- 
2.25.1


  parent reply	other threads:[~2022-03-01  5:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  5:04 [PATCH net-next v3 00/12] vxlan metadata device vnifiltering support Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 01/12] vxlan: move to its own directory Roopa Prabhu
2022-03-01  5:04 ` Roopa Prabhu [this message]
2022-03-01  5:04 ` [PATCH net-next v3 03/12] vxlan_core: move common declarations to private header file Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 04/12] vxlan_core: move some fdb helpers to non-static Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 05/12] vxlan_core: make multicast helper take rip and ifindex explicitly Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 06/12] vxlan_core: add helper vxlan_vni_in_use Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 07/12] rtnetlink: add new rtm tunnel api for tunnel id filtering Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 08/12] vxlan_multicast: Move multicast helpers to a separate file Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 09/12] vxlan: vni filtering support on collect metadata device Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 10/12] selftests: add new tests for vxlan vnifiltering Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 11/12] drivers: vxlan: vnifilter: per vni stats Roopa Prabhu
2022-03-01  5:04 ` [PATCH net-next v3 12/12] drivers: vxlan: vnifilter: add support for stats dumping Roopa Prabhu
2022-03-01  8:50 ` [PATCH net-next v3 00/12] vxlan metadata device vnifiltering support patchwork-bot+netdevbpf

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=20220301050439.31785-3-roopa@nvidia.com \
    --to=roopa@nvidia.com \
    --cc=bpoirier@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.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).