Skip to content

Commit

Permalink
ipv6: fix sparse warnings in privacy stable addresses generation
Browse files Browse the repository at this point in the history
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: 622c81d ("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>
  • Loading branch information
Hannes Frederic Sowa authored and David S. Miller committed Mar 24, 2015
1 parent ed3e852 commit ff40217
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2906,7 +2906,7 @@ static int ipv6_generate_stable_address(struct in6_addr *address,
char __data[SHA_MESSAGE_BYTES];
struct {
struct in6_addr secret;
__be64 prefix;
__be32 prefix[2];
unsigned char hwaddr[MAX_ADDR_LEN];
u8 dad_count;
} __packed;
Expand All @@ -2932,16 +2932,16 @@ static int ipv6_generate_stable_address(struct in6_addr *address,
memset(&data, 0, sizeof(data));
memset(workspace, 0, sizeof(workspace));
memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len);
data.prefix = ((__be64)address->s6_addr32[0] << 32) |
(__be64)address->s6_addr32[1];
data.prefix[0] = address->s6_addr32[0];
data.prefix[1] = address->s6_addr32[1];
data.secret = secret;
data.dad_count = dad_count;

sha_transform(digest, data.__data, workspace);

temp = *address;
temp.s6_addr32[2] = digest[0];
temp.s6_addr32[3] = digest[1];
temp.s6_addr32[2] = (__force __be32)digest[0];
temp.s6_addr32[3] = (__force __be32)digest[1];

spin_unlock_bh(&lock);

Expand Down

0 comments on commit ff40217

Please sign in to comment.