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

From: David Miller
Date: Mon Aug 27 2018 - 18:24:05 EST


From: Haiqing Bai <Haiqing.Bai@xxxxxxxxxxxxx>
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 <zhenbo.gao@xxxxxxxxxxxxx>
> Acked-by: Jon Maloy <jon.maloy@xxxxxxxxxxxx>
> Signed-off-by: Haiqing Bai <Haiqing.Bai@xxxxxxxxxxxxx>

Applied and queued up for -stable.