net: sched: em_nbyte: don't add the data offset twice

This change “net: sched: em_nbyte: don't add the data offset twice” (commit 560a660) in Linux kernel is authored by Wolfgang Bumiller <w.bumiller [at] proxmox.com> on Thu Jan 18 11:32:35 2018 +0100.

Description of "net: sched: em_nbyte: don't add the data offset twice"

The change “net: sched: em_nbyte: don't add the data offset twice” introduces changes as follows.

net: sched: em_nbyte: don't add the data offset twice

'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>

Linux kernel releases containing commit 560a660

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "net: sched: em_nbyte: don't add the data offset twice"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/sched/em_nbyte.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c
index df3110d69585..07c10bac06a0 100644
--- a/net/sched/em_nbyte.c
+++ b/net/sched/em_nbyte.c
@@ -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 = {

The commit for this change in Linux stable tree is 560a660 (patch).

Last modified: 2020/02/09