Re: [PATCH 05/10] netfilter: nf_tables: fix mismatch in big-endian system

2017-03-16 Thread Liping Zhang
Hi David, 2017-03-16 18:58 GMT+08:00 David Laight : [...] >> For the similar reason, when loading an u16 value from the u32 data >> register, we should use "*(u16 *) sreg;" instead of "(u16)*sreg;", >> the 2nd method will get the wrong value in the big-endian system. > ...

RE: [PATCH 05/10] netfilter: nf_tables: fix mismatch in big-endian system

2017-03-16 Thread David Laight
From: Pablo Neira Ayuso > Sent: 15 March 2017 17:01 > From: Liping Zhang > > Currently, there are two different methods to store an u16 integer to > the u32 data register. For example: > u32 *dest = >data[priv->dreg]; > 1. *dest = 0; *(u16 *) dest = val_u16; > 2. *dest

[PATCH 05/10] netfilter: nf_tables: fix mismatch in big-endian system

2017-03-15 Thread Pablo Neira Ayuso
From: Liping Zhang Currently, there are two different methods to store an u16 integer to the u32 data register. For example: u32 *dest = >data[priv->dreg]; 1. *dest = 0; *(u16 *) dest = val_u16; 2. *dest = val_u16; For method 1, the u16 value will be stored like this,