From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [V2][PATCH net] tipc: fix the big/little endian issue in tipc_dest Date: Mon, 27 Aug 2018 15:24:02 -0700 (PDT) Message-ID: <20180827.152402.1358178279473378697.davem@davemloft.net> References: <1535333546-16753-1-git-send-email-Haiqing.Bai@windriver.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, jon.maloy@ericsson.com, ying.xue@windriver.com, zhenbo.gao@windriver.com, linux-kernel@vger.kernel.org To: Haiqing.Bai@windriver.com Return-path: In-Reply-To: <1535333546-16753-1-git-send-email-Haiqing.Bai@windriver.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Haiqing Bai 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 > Acked-by: Jon Maloy > Signed-off-by: Haiqing Bai Applied and queued up for -stable.