Commit de4c1f8b authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

flow_dissector: Fix function argument ordering dependency

Commit c6cc1ca7 ("flowi: Abstract out functions to get flow hash
based on flowi") introduced a bug in __skb_set_sw_hash where we
require a dependency on evaluating arguments in a function in order.
There is no such ordering enforced in C, so this incorrect. This
patch fixes that by splitting out the arguments. This bug was
found via a compiler warning that keys may be uninitialized.
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1bd40543
...@@ -1035,9 +1035,9 @@ static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6) ...@@ -1035,9 +1035,9 @@ static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, struct flowi6 *fl6)
{ {
if (!skb->l4_hash && !skb->sw_hash) { if (!skb->l4_hash && !skb->sw_hash) {
struct flow_keys keys; struct flow_keys keys;
__u32 hash = __get_hash_from_flowi6(fl6, &keys);
__skb_set_sw_hash(skb, __get_hash_from_flowi6(fl6, &keys), __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys));
flow_keys_have_l4(&keys));
} }
return skb->hash; return skb->hash;
...@@ -1049,9 +1049,9 @@ static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, struct flowi4 *fl4) ...@@ -1049,9 +1049,9 @@ static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, struct flowi4 *fl4)
{ {
if (!skb->l4_hash && !skb->sw_hash) { if (!skb->l4_hash && !skb->sw_hash) {
struct flow_keys keys; struct flow_keys keys;
__u32 hash = __get_hash_from_flowi4(fl4, &keys);
__skb_set_sw_hash(skb, __get_hash_from_flowi4(fl4, &keys), __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys));
flow_keys_have_l4(&keys));
} }
return skb->hash; return skb->hash;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment