Skip to content

Commit

Permalink
net: sched: em_nbyte: don't add the data offset twice
Browse files Browse the repository at this point in the history
'ptr' is shifted by the offset and then validated,
the memcmp should not add it a second time.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wolfgang Bumiller authored and David S. Miller committed Jan 24, 2018
1 parent 1ecdaea commit 560a660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/em_nbyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int em_nbyte_match(struct sk_buff *skb, struct tcf_ematch *em,
if (!tcf_valid_offset(skb, ptr, nbyte->hdr.len))
return 0;

return !memcmp(ptr + nbyte->hdr.off, nbyte->pattern, nbyte->hdr.len);
return !memcmp(ptr, nbyte->pattern, nbyte->hdr.len);
}

static struct tcf_ematch_ops em_nbyte_ops = {
Expand Down

0 comments on commit 560a660

Please sign in to comment.