Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: fix sparse warnings in privacy stable addresses generation

Those warnings reported by sparse endianness check (via kbuild test robot)
are harmless, nevertheless fix them up and make the code a little bit
easier to read.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 622c81d57b392cc ("ipv6: generation of stable privacy addresses for link-local and autoconf")
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hannes Frederic Sowa and committed by
David S. Miller
ff40217e ed3e852a

+5 -5
+5 -5
net/ipv6/addrconf.c
··· 2906 2906 char __data[SHA_MESSAGE_BYTES]; 2907 2907 struct { 2908 2908 struct in6_addr secret; 2909 - __be64 prefix; 2909 + __be32 prefix[2]; 2910 2910 unsigned char hwaddr[MAX_ADDR_LEN]; 2911 2911 u8 dad_count; 2912 2912 } __packed; ··· 2932 2932 memset(&data, 0, sizeof(data)); 2933 2933 memset(workspace, 0, sizeof(workspace)); 2934 2934 memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len); 2935 - data.prefix = ((__be64)address->s6_addr32[0] << 32) | 2936 - (__be64)address->s6_addr32[1]; 2935 + data.prefix[0] = address->s6_addr32[0]; 2936 + data.prefix[1] = address->s6_addr32[1]; 2937 2937 data.secret = secret; 2938 2938 data.dad_count = dad_count; 2939 2939 2940 2940 sha_transform(digest, data.__data, workspace); 2941 2941 2942 2942 temp = *address; 2943 - temp.s6_addr32[2] = digest[0]; 2944 - temp.s6_addr32[3] = digest[1]; 2943 + temp.s6_addr32[2] = (__force __be32)digest[0]; 2944 + temp.s6_addr32[3] = (__force __be32)digest[1]; 2945 2945 2946 2946 spin_unlock_bh(&lock); 2947 2947