Commit fc5ad582 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

tipc: Fix bug in topology server byte swapping routine

This patch fixes TIPC's topology server so that it does byte swapping
correctly when endianness conversion is required.  (Note: This bug only
impacted an application if it issues a subscription request to a
topology server on another node, rather than the server on it's own
node; since the topology server is normally not accessible by off-node
applications, most TIPC applications were not impacted by the bug.)
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e9501f5
...@@ -86,9 +86,7 @@ static struct top_srv topsrv = { 0 }; ...@@ -86,9 +86,7 @@ static struct top_srv topsrv = { 0 };
static u32 htohl(u32 in, int swap) static u32 htohl(u32 in, int swap)
{ {
char *c = (char *)&in; return swap ? (u32)___constant_swab32(in) : in;
return swap ? ((c[3] << 3) + (c[2] << 2) + (c[1] << 1) + c[0]) : in;
} }
/** /**
......
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