flow_dissector: Fix function argument ordering dependency
Commit c6cc1ca7f4d70c ("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: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9e62687..eabfb81 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1035,9 +1035,9 @@
{
if (!skb->l4_hash && !skb->sw_hash) {
struct flow_keys keys;
+ __u32 hash = __get_hash_from_flowi6(fl6, &keys);
- __skb_set_sw_hash(skb, __get_hash_from_flowi6(fl6, &keys),
- flow_keys_have_l4(&keys));
+ __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys));
}
return skb->hash;
@@ -1049,9 +1049,9 @@
{
if (!skb->l4_hash && !skb->sw_hash) {
struct flow_keys keys;
+ __u32 hash = __get_hash_from_flowi4(fl4, &keys);
- __skb_set_sw_hash(skb, __get_hash_from_flowi4(fl4, &keys),
- flow_keys_have_l4(&keys));
+ __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys));
}
return skb->hash;