Thread (2 messages) flat view 2 messages, 2 authors, 2018-08-27

Re: [V2][PATCH net] tipc: fix the big/little endian issue in tipc_dest

From: David Miller <davem@davemloft.net>
Date: 2018-08-27 22:24:06
Also in: lkml

From: Haiqing Bai <redacted>
Date: Mon, 27 Aug 2018 09:32:26 +0800
In function tipc_dest_push, the 32bit variables 'node' and 'port'
are stored separately in uppper and lower part of 64bit 'value'.
Then this value is assigned to dst->value which is a union like:
union
{
  struct {
    u32 port;
    u32 node;
  };
  u64 value;
}
This works on little-endian machines like x86 but fails on big-endian
machines.

The fix remove the 'value' stack parameter and even the 'value'
member of the union in tipc_dest, assign the 'node' and 'port' member
directly with the input parameter to avoid the endian issue.

Fixes: a80ae5306a73 ("tipc: improve destination linked list")

Signed-off-by: Zhenbo Gao <redacted>
Acked-by: Jon Maloy <redacted>
Signed-off-by: Haiqing Bai <redacted>
Applied and queued up for -stable.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help