Commit ff40217e authored by Hannes Frederic Sowa's avatar Hannes Frederic Sowa Committed by David S. Miller

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: default avatarkbuild test robot <fengguang.wu@intel.com>
Fixes: 622c81d5 ("ipv6: generation of stable privacy addresses for link-local and autoconf")
Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed3e852a
...@@ -2906,7 +2906,7 @@ static int ipv6_generate_stable_address(struct in6_addr *address, ...@@ -2906,7 +2906,7 @@ static int ipv6_generate_stable_address(struct in6_addr *address,
char __data[SHA_MESSAGE_BYTES]; char __data[SHA_MESSAGE_BYTES];
struct { struct {
struct in6_addr secret; struct in6_addr secret;
__be64 prefix; __be32 prefix[2];
unsigned char hwaddr[MAX_ADDR_LEN]; unsigned char hwaddr[MAX_ADDR_LEN];
u8 dad_count; u8 dad_count;
} __packed; } __packed;
...@@ -2932,16 +2932,16 @@ static int ipv6_generate_stable_address(struct in6_addr *address, ...@@ -2932,16 +2932,16 @@ static int ipv6_generate_stable_address(struct in6_addr *address,
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
memset(workspace, 0, sizeof(workspace)); memset(workspace, 0, sizeof(workspace));
memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len); memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len);
data.prefix = ((__be64)address->s6_addr32[0] << 32) | data.prefix[0] = address->s6_addr32[0];
(__be64)address->s6_addr32[1]; data.prefix[1] = address->s6_addr32[1];
data.secret = secret; data.secret = secret;
data.dad_count = dad_count; data.dad_count = dad_count;
sha_transform(digest, data.__data, workspace); sha_transform(digest, data.__data, workspace);
temp = *address; temp = *address;
temp.s6_addr32[2] = digest[0]; temp.s6_addr32[2] = (__force __be32)digest[0];
temp.s6_addr32[3] = digest[1]; temp.s6_addr32[3] = (__force __be32)digest[1];
spin_unlock_bh(&lock); spin_unlock_bh(&lock);
......
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