[Devel] [PATCH RHEL7 COMMIT] ms/ipv6: fix sparse errors in ip6_make_flowlabel()

Vasily Averin vvs at virtuozzo.com
Tue Oct 26 14:26:16 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.2
------>
commit d494a78804bdd04e695f1f5205f84faa1440dc7c
Author: Eric Dumazet <edumazet at google.com>
Date:   Tue Oct 26 14:26:16 2021 +0300

    ms/ipv6: fix sparse errors in ip6_make_flowlabel()
    
    include/net/ipv6.h:713:22: warning: incorrect type in assignment (different base types)
    include/net/ipv6.h:713:22:    expected restricted __be32 [usertype] hash
    include/net/ipv6.h:713:22:    got unsigned int
    include/net/ipv6.h:719:25: warning: restricted __be32 degrades to integer
    include/net/ipv6.h:719:22: warning: invalid assignment: ^=
    include/net/ipv6.h:719:22:    left side has type restricted __be32
    include/net/ipv6.h:719:22:    right side has type unsigned int
    
    Signed-off-by: Eric Dumazet <edumazet at google.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    (cherry picked from commit 677651462c774b5866be2bc42601303a76b021a0)
    https://pmc.acronis.com/browse/VSTOR-47671
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 include/net/ipv6.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index daa5937..a22cd2e 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -721,7 +721,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
 					__be32 flowlabel, bool autolabel)
 {
 	if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
-		__be32 hash;
+		u32 hash;
 
 		hash = skb_get_hash(skb);
 
@@ -731,7 +731,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
 		 */
 		hash ^= hash >> 12;
 
-		flowlabel = hash & IPV6_FLOWLABEL_MASK;
+		flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK;
 	}
 
 	return flowlabel;


More information about the Devel mailing list