From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Bumiller Subject: [PATCH net 1/2] net: sched: em_nbyte: don't add the data offset twice Date: Thu, 18 Jan 2018 11:32:35 +0100 Message-ID: <20180118103236.32494-3-w.bumiller@proxmox.com> References: <20180118103236.32494-1-w.bumiller@proxmox.com> Cc: Stephen Hemminger , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S . Miller" To: netdev@vger.kernel.org Return-path: Received: from proxmox-new.maurer-it.com ([212.186.127.180]:1869 "EHLO proxmox-new.maurer-it.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755718AbeARKcj (ORCPT ); Thu, 18 Jan 2018 05:32:39 -0500 In-Reply-To: <20180118103236.32494-1-w.bumiller@proxmox.com> Sender: netdev-owner@vger.kernel.org List-ID: 'ptr' is shifted by the offset and then validated, the memcmp should not add it a second time. Signed-off-by: Wolfgang Bumiller --- 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 @@ -47,15 +47,15 @@ static int em_nbyte_match(struct sk_buff *skb, struct tcf_ematch *em, unsigned char *ptr = tcf_get_base_ptr(skb, nbyte->hdr.layer); ptr += nbyte->hdr.off; 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 = { .kind = TCF_EM_NBYTE, .change = em_nbyte_change, .match = em_nbyte_match, .owner = THIS_MODULE, -- 2.11.0