* [PATCH net 0/3] ipv4: fix various issues reported by sparse
@ 2016-01-06 22:22 Lance Richardson
2016-01-06 22:22 ` [PATCH net 1/3] ipv4: fix endianness warnings in ip_tunnel_core.c Lance Richardson
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Lance Richardson @ 2016-01-06 22:22 UTC (permalink / raw)
To: netdev
This trivial patch series addresses a number of endianness- and
lock-related issues reported by sparse.
Lance Richardson (3):
ipv4: fix endianness warnings in ip_tunnel_core.c
ipv4: eliminate endianness warnings in ip_fib.h
ipv4: eliminate lock count warnings in ping.c
include/net/ip_fib.h | 3 ++-
net/ipv4/ip_tunnel_core.c | 16 ++++++++--------
net/ipv4/ping.c | 2 ++
3 files changed, 12 insertions(+), 9 deletions(-)
--
2.5.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 1/3] ipv4: fix endianness warnings in ip_tunnel_core.c
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
@ 2016-01-06 22:22 ` Lance Richardson
2016-01-06 22:22 ` [PATCH net 2/3] ipv4: eliminate endianness warnings in ip_fib.h Lance Richardson
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2016-01-06 22:22 UTC (permalink / raw)
To: netdev
Eliminate endianness mismatch warnings (reported by sparse) in this file by
using appropriate nla_put_*()/nla_get_*() calls.
Signed-off-by: Lance Richardson <lrichard@redhat.com>
---
net/ipv4/ip_tunnel_core.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 6cb9009..bf70c1c 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -251,7 +251,7 @@ static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr,
tun_info = lwt_tun_info(new_state);
if (tb[LWTUNNEL_IP_ID])
- tun_info->key.tun_id = nla_get_u64(tb[LWTUNNEL_IP_ID]);
+ tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP_ID]);
if (tb[LWTUNNEL_IP_DST])
tun_info->key.u.ipv4.dst = nla_get_be32(tb[LWTUNNEL_IP_DST]);
@@ -266,7 +266,7 @@ static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr,
tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP_TOS]);
if (tb[LWTUNNEL_IP_FLAGS])
- tun_info->key.tun_flags = nla_get_u16(tb[LWTUNNEL_IP_FLAGS]);
+ tun_info->key.tun_flags = nla_get_be16(tb[LWTUNNEL_IP_FLAGS]);
tun_info->mode = IP_TUNNEL_INFO_TX;
tun_info->options_len = 0;
@@ -281,12 +281,12 @@ static int ip_tun_fill_encap_info(struct sk_buff *skb,
{
struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
- if (nla_put_u64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) ||
+ if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) ||
nla_put_be32(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
nla_put_be32(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) ||
nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) ||
- nla_put_u16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags))
+ nla_put_be16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags))
return -ENOMEM;
return 0;
@@ -346,7 +346,7 @@ static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr,
tun_info = lwt_tun_info(new_state);
if (tb[LWTUNNEL_IP6_ID])
- tun_info->key.tun_id = nla_get_u64(tb[LWTUNNEL_IP6_ID]);
+ tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP6_ID]);
if (tb[LWTUNNEL_IP6_DST])
tun_info->key.u.ipv6.dst = nla_get_in6_addr(tb[LWTUNNEL_IP6_DST]);
@@ -361,7 +361,7 @@ static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr,
tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP6_TC]);
if (tb[LWTUNNEL_IP6_FLAGS])
- tun_info->key.tun_flags = nla_get_u16(tb[LWTUNNEL_IP6_FLAGS]);
+ tun_info->key.tun_flags = nla_get_be16(tb[LWTUNNEL_IP6_FLAGS]);
tun_info->mode = IP_TUNNEL_INFO_TX | IP_TUNNEL_INFO_IPV6;
tun_info->options_len = 0;
@@ -376,12 +376,12 @@ static int ip6_tun_fill_encap_info(struct sk_buff *skb,
{
struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
- if (nla_put_u64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id) ||
+ if (nla_put_be64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id) ||
nla_put_in6_addr(skb, LWTUNNEL_IP6_DST, &tun_info->key.u.ipv6.dst) ||
nla_put_in6_addr(skb, LWTUNNEL_IP6_SRC, &tun_info->key.u.ipv6.src) ||
nla_put_u8(skb, LWTUNNEL_IP6_HOPLIMIT, tun_info->key.tos) ||
nla_put_u8(skb, LWTUNNEL_IP6_TC, tun_info->key.ttl) ||
- nla_put_u16(skb, LWTUNNEL_IP6_FLAGS, tun_info->key.tun_flags))
+ nla_put_be16(skb, LWTUNNEL_IP6_FLAGS, tun_info->key.tun_flags))
return -ENOMEM;
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/3] ipv4: eliminate endianness warnings in ip_fib.h
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
2016-01-06 22:22 ` [PATCH net 1/3] ipv4: fix endianness warnings in ip_tunnel_core.c Lance Richardson
@ 2016-01-06 22:22 ` Lance Richardson
2016-01-06 22:22 ` [PATCH net 3/3] ipv4: eliminate lock count warnings in ping.c Lance Richardson
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2016-01-06 22:22 UTC (permalink / raw)
To: netdev
fib_multipath_hash() computes a hash using __be32 values, force
cast these to u32 to pacify sparse.
Signed-off-by: Lance Richardson <lrichard@redhat.com>
---
include/net/ip_fib.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9f4df68..7029527 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -325,7 +325,8 @@ extern u32 fib_multipath_secret __read_mostly;
static inline int fib_multipath_hash(__be32 saddr, __be32 daddr)
{
- return jhash_2words(saddr, daddr, fib_multipath_secret) >> 1;
+ return jhash_2words((__force u32)saddr, (__force u32)daddr,
+ fib_multipath_secret) >> 1;
}
void fib_select_multipath(struct fib_result *res, int hash);
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 3/3] ipv4: eliminate lock count warnings in ping.c
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
2016-01-06 22:22 ` [PATCH net 1/3] ipv4: fix endianness warnings in ip_tunnel_core.c Lance Richardson
2016-01-06 22:22 ` [PATCH net 2/3] ipv4: eliminate endianness warnings in ip_fib.h Lance Richardson
@ 2016-01-06 22:22 ` Lance Richardson
2016-01-06 23:08 ` Fwd: [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
2016-01-09 2:31 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2016-01-06 22:22 UTC (permalink / raw)
To: netdev
Add lock release/acquire annotations to ping_seq_start() and
ping_seq_stop() to satisfy sparse.
Signed-off-by: Lance Richardson <lrichard@redhat.com>
---
net/ipv4/ping.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index e89094a..c117b21 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1063,6 +1063,7 @@ static struct sock *ping_get_idx(struct seq_file *seq, loff_t pos)
}
void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family)
+ __acquires(ping_table.lock)
{
struct ping_iter_state *state = seq->private;
state->bucket = 0;
@@ -1094,6 +1095,7 @@ void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos)
EXPORT_SYMBOL_GPL(ping_seq_next);
void ping_seq_stop(struct seq_file *seq, void *v)
+ __releases(ping_table.lock)
{
read_unlock_bh(&ping_table.lock);
}
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Fwd: [PATCH net 0/3] ipv4: fix various issues reported by sparse
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
` (2 preceding siblings ...)
2016-01-06 22:22 ` [PATCH net 3/3] ipv4: eliminate lock count warnings in ping.c Lance Richardson
@ 2016-01-06 23:08 ` Lance Richardson
2016-01-09 2:31 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2016-01-06 23:08 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
----- Forwarded Message -----
> This trivial patch series addresses a number of endianness- and
> lock-related issues reported by sparse.
>
> Lance Richardson (3):
> ipv4: fix endianness warnings in ip_tunnel_core.c
> ipv4: eliminate endianness warnings in ip_fib.h
> ipv4: eliminate lock count warnings in ping.c
>
> include/net/ip_fib.h | 3 ++-
> net/ipv4/ip_tunnel_core.c | 16 ++++++++--------
> net/ipv4/ping.c | 2 ++
> 3 files changed, 12 insertions(+), 9 deletions(-)
>
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Apologies, I must have fumbled the "--cc-cmd=" option to git send-email.
Resending cover letter with cc: list.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/3] ipv4: fix various issues reported by sparse
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
` (3 preceding siblings ...)
2016-01-06 23:08 ` Fwd: [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
@ 2016-01-09 2:31 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-01-09 2:31 UTC (permalink / raw)
To: lrichard; +Cc: netdev
From: Lance Richardson <lrichard@redhat.com>
Date: Wed, 6 Jan 2016 17:22:44 -0500
> This trivial patch series addresses a number of endianness- and
> lock-related issues reported by sparse.
Series applied to net-next, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-09 2:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06 22:22 [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
2016-01-06 22:22 ` [PATCH net 1/3] ipv4: fix endianness warnings in ip_tunnel_core.c Lance Richardson
2016-01-06 22:22 ` [PATCH net 2/3] ipv4: eliminate endianness warnings in ip_fib.h Lance Richardson
2016-01-06 22:22 ` [PATCH net 3/3] ipv4: eliminate lock count warnings in ping.c Lance Richardson
2016-01-06 23:08 ` Fwd: [PATCH net 0/3] ipv4: fix various issues reported by sparse Lance Richardson
2016-01-09 2:31 ` David Miller
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).