diff mbox

[1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag

Message ID 1403603969-24436-1-git-send-email-kda@linux-powerpc.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Denis Kirjanov June 24, 2014, 9:59 a.m. UTC
Use the proper mask which is 0xefff
---
 arch/powerpc/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexei Starovoitov June 24, 2014, 3:29 p.m. UTC | #1
On Tue, Jun 24, 2014 at 2:59 AM, Denis Kirjanov <kda@linux-powerpc.org> wrote:
> Use the proper mask which is 0xefff

sob is missing.

also please expand the commit message a bit, otherwise it's too cryptic for
folks who don't know bpf details.

> ---
>  arch/powerpc/net/bpf_jit_comp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index 6dcdade..af0ed4d 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -393,7 +393,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
>                         PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
>                                                           vlan_tci));
>                         if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
> -                               PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
> +                               PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
>                         else
>                                 PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
>                         break;
> --
> 2.0.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdade..af0ed4d 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -393,7 +393,7 @@  static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
 			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
 							  vlan_tci));
 			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
-				PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+				PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
 			else
 				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
 			break;