From: Patrick McHardy Date: Tue, 5 Jul 2005 21:10:40 +0000 (-0700) Subject: [NET]: net/core/filter.c: make len cover the entire packet X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3154e540e374bbfd62693d95bc8ed51da95efe75;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [NET]: net/core/filter.c: make len cover the entire packet As suggested by Herbert Xu: Since we don't require anything to be in the linear packet range anymore make len cover the entire packet. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/net/core/filter.c b/net/core/filter.c index 3923428a840f..cd91a24f9720 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -76,10 +76,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k, int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) { - /* len is UNSIGNED. Byte wide insns relies only on implicit - type casts to prevent reading arbitrary memory locations. - */ - unsigned int len = skb->len-skb->data_len; struct sock_filter *fentry; /* We walk down these */ void *ptr; u32 A = 0; /* Accumulator */ @@ -206,10 +202,10 @@ load_b: } return 0; case BPF_LD|BPF_W|BPF_LEN: - A = len; + A = skb->len; continue; case BPF_LDX|BPF_W|BPF_LEN: - X = len; + X = skb->len; continue; case BPF_LD|BPF_W|BPF_IND: k = X + fentry->k;