From: Stefano Brivio <sbrivio@redhat.com>
To: Joe Perches <joe@perches.com>,
Nathan Chancellor <natechancellor@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Cc: Sabrina Dubroca <sd@queasysnail.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] geneve: Use empty braces for addr6 initializer
Date: Sat, 17 Nov 2018 12:31:46 +0100 [thread overview]
Message-ID: <20181117123110.4caca757@redhat.com> (raw)
In-Reply-To: <138f1c15387c47fe65f4a0448f35afdd9db81933.camel@perches.com>
On Fri, 16 Nov 2018 18:33:40 -0800
Joe Perches <joe@perches.com> wrote:
> If this is really an issue, I don't know why the other uses
> haven't been reported.
It causes warnings with some older gcc versions and clang, I don't see
it as an issue, but others might.
> Perhaps change the rest of them too?
But then look, we already have a delicious strict C89 initialiser in
include/linux/in6.h, and we can do this:
drivers/net/geneve.c | 4 ++--
include/net/ip6_fib.h | 9 +++------
include/trace/events/fib6.h | 4 +---
net/6lowpan/iphc.c | 12 ++++++------
4 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 7c53e06b31c3..96588adc294c 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -191,7 +191,7 @@ static struct geneve_dev *geneve_lookup_skb(struct geneve_sock *gs,
return geneve_lookup(gs, addr, vni);
#if IS_ENABLED(CONFIG_IPV6)
} else if (geneve_get_sk_family(gs) == AF_INET6) {
- static struct in6_addr zero_addr6;
+ struct in6_addr zero_addr6 = IN6ADDR_ANY_INIT;
struct ipv6hdr *ip6h;
struct in6_addr addr6;
@@ -424,8 +424,8 @@ static int geneve_udp_encap_err_lookup(struct sock *sk, struct sk_buff *skb)
#if IS_ENABLED(CONFIG_IPV6)
if (geneve_get_sk_family(gs) == AF_INET6) {
+ struct in6_addr addr6 = IN6ADDR_ANY_INIT;
struct ipv6hdr *ip6h = ipv6_hdr(skb);
- struct in6_addr addr6 = { 0 };
if (!gs->collect_md) {
vni = geneve_hdr(skb)->vni;
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 84097010237c..24543caf5a9f 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -427,13 +427,10 @@ void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)
rcu_read_lock();
from = rcu_dereference(rt->from);
- if (from) {
+ if (from)
*addr = from->fib6_prefsrc.addr;
- } else {
- struct in6_addr in6_zero = {};
-
- *addr = in6_zero;
- }
+ else
+ *addr = in6addr_any;
rcu_read_unlock();
}
diff --git a/include/trace/events/fib6.h b/include/trace/events/fib6.h
index b088b54d699c..6496ca1594ac 100644
--- a/include/trace/events/fib6.h
+++ b/include/trace/events/fib6.h
@@ -68,10 +68,8 @@ TRACE_EVENT(fib6_table_lookup,
__assign_str(name, "-");
}
if (f6i == net->ipv6.fib6_null_entry) {
- struct in6_addr in6_zero = {};
-
in6 = (struct in6_addr *)__entry->gw;
- *in6 = in6_zero;
+ *in6 = in6addr_any;
} else if (f6i) {
in6 = (struct in6_addr *)__entry->gw;
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 52fad5dad9f7..f0e0bac91e71 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -246,8 +246,8 @@ lowpan_iphc_ctx_get_by_mcast_addr(const struct net_device *dev,
const struct in6_addr *addr)
{
struct lowpan_iphc_ctx *table = lowpan_dev(dev)->ctx.table;
+ struct in6_addr addr_mcast, network_pfx = IN6ADDR_ANY_INIT;
struct lowpan_iphc_ctx *ret = NULL;
- struct in6_addr addr_mcast, network_pfx = {};
int i;
/* init mcast address with */
@@ -481,7 +481,7 @@ static int lowpan_uncompress_multicast_ctx_daddr(struct sk_buff *skb,
struct in6_addr *ipaddr,
u8 address_mode)
{
- struct in6_addr network_pfx = {};
+ struct in6_addr network_pfx = IN6ADDR_ANY_INIT;
bool fail;
ipaddr->s6_addr[0] = 0xFF;
@@ -794,8 +794,8 @@ lowpan_iphc_compress_ctx_802154_lladdr(const struct in6_addr *ipaddr,
{
const struct ieee802154_addr *addr = lladdr;
unsigned char extended_addr[EUI64_ADDR_LEN];
+ struct in6_addr tmp = IN6ADDR_ANY_INIT;
bool lladdr_compress = false;
- struct in6_addr tmp = {};
switch (addr->mode) {
case IEEE802154_ADDR_LONG:
@@ -833,7 +833,7 @@ static bool lowpan_iphc_addr_equal(const struct net_device *dev,
const struct in6_addr *ipaddr,
const void *lladdr)
{
- struct in6_addr tmp = {};
+ struct in6_addr tmp = IN6ADDR_ANY_INIT;
lowpan_iphc_uncompress_lladdr(dev, &tmp, lladdr);
@@ -848,7 +848,7 @@ static u8 lowpan_compress_ctx_addr(u8 **hc_ptr, const struct net_device *dev,
const struct lowpan_iphc_ctx *ctx,
const unsigned char *lladdr, bool sam)
{
- struct in6_addr tmp = {};
+ struct in6_addr tmp = IN6ADDR_ANY_INIT;
u8 dam;
switch (lowpan_dev(dev)->lltype) {
@@ -907,8 +907,8 @@ lowpan_iphc_compress_802154_lladdr(const struct in6_addr *ipaddr,
{
const struct ieee802154_addr *addr = lladdr;
unsigned char extended_addr[EUI64_ADDR_LEN];
+ struct in6_addr tmp = IN6ADDR_ANY_INIT;
bool lladdr_compress = false;
- struct in6_addr tmp = {};
switch (addr->mode) {
case IEEE802154_ADDR_LONG:
--
Stefano
next prev parent reply other threads:[~2018-11-17 11:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 22:12 [PATCH] geneve: Add missing braces in addr6 initializer Nathan Chancellor
2018-11-12 22:19 ` Stefano Brivio
2018-11-12 22:20 ` Nathan Chancellor
2018-11-12 22:36 ` Joe Perches
2018-11-13 6:11 ` [PATCH net-next v2] geneve: Use empty braces for " Nathan Chancellor
2018-11-13 9:02 ` Stefano Brivio
2018-11-16 14:04 ` Stefano Brivio
2018-11-16 15:37 ` Nathan Chancellor
2018-11-17 2:33 ` Joe Perches
2018-11-17 11:31 ` Stefano Brivio [this message]
2018-11-16 20:35 ` David Miller
2018-11-17 1:36 ` [PATCH net-next v3] geneve: Initialize addr6 with memset Nathan Chancellor
2018-11-18 6:03 ` David Miller
2018-11-15 19:35 ` [PATCH] geneve: Add missing braces in addr6 initializer David Miller
2018-11-15 19:38 ` Nathan Chancellor
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=20181117123110.4caca757@redhat.com \
--to=sbrivio@redhat.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.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).