Skip to content

Commit

Permalink
[NET]: net/core/filter.c: make len cover the entire packet
Browse files Browse the repository at this point in the history
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 <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jul 5, 2005
1 parent 0b05b2a commit 3154e54
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -206,10 +202,10 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
}
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;
Expand Down

0 comments on commit 3154e54

Please sign in to comment.