x86: bpf_jit: fix FROM_BE16 and FROM_LE16/32 instructions
authorAlexei Starovoitov <ast@plumgrid.com>
Tue, 12 May 2015 06:25:16 +0000 (23:25 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 May 2015 03:13:08 +0000 (23:13 -0400)
commit343f845b375989f1753f605902931fa939aa2223
treefd2f63ee5b1cf7921993a4f9a0f35c80ac2e5485
parente3d8ecb70e16412b14fb11c1b68ecb533bd4ea64
x86: bpf_jit: fix FROM_BE16 and FROM_LE16/32 instructions

FROM_BE16:
'ror %reg, 8' doesn't clear upper bits of the register,
so use additional 'movzwl' insn to zero extend 16 bits into 64

FROM_LE16:
should zero extend lower 16 bits into 64 bit

FROM_LE32:
should zero extend lower 32 bits into 64 bit

Fixes: 89aa075832b0 ("net: sock: allow eBPF programs to be attached to sockets")
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/x86/net/bpf_jit_comp.c