From: Daniel Borkmann Date: Thu, 22 Jan 2015 09:58:18 +0000 (+0100) Subject: net: cls_basic: return from walking on match in basic_get X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1c1bc6bdb7f529eb3383b6e34a0ea327d7e9f615;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git net: cls_basic: return from walking on match in basic_get As soon as we've found a matching handle in basic_get(), we can return it. There's no need to continue walking until the end of a filter chain, since they are unique anyway. Signed-off-by: Daniel Borkmann Acked-by: Jiri Pirko Cc: Thomas Graf Acked-by: Thomas Graf Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 5aed341406c2..fc399db86f11 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c @@ -65,9 +65,12 @@ static unsigned long basic_get(struct tcf_proto *tp, u32 handle) if (head == NULL) return 0UL; - list_for_each_entry(f, &head->flist, link) - if (f->handle == handle) + list_for_each_entry(f, &head->flist, link) { + if (f->handle == handle) { l = (unsigned long) f; + break; + } + } return l; }