summaryrefslogtreecommitdiffstats
path: root/net/sched/cls_flow.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-02-06 01:19:59 +0100
committerDavid S. Miller <davem@davemloft.net>2008-02-06 01:19:59 +0100
commit4f25049106e0507ff21a9e1fc0645d849e19faf0 (patch)
tree0bb28370f4ef81d89030e56df0cf192b778e67dd /net/sched/cls_flow.c
parent[NET_SCHED]: em_meta: fix compile warning (diff)
downloadlinux-4f25049106e0507ff21a9e1fc0645d849e19faf0.tar.xz
linux-4f25049106e0507ff21a9e1fc0645d849e19faf0.zip
[NET_SCHED]: cls_flow: fix key mask validity check
Since we're using fls(), we need to check whether the value is non-zero first. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_flow.c')
-rw-r--r--net/sched/cls_flow.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 8d7698621f0a..eeb223cf14cf 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -402,12 +402,13 @@ static int flow_change(struct tcf_proto *tp, unsigned long base,
if (tb[TCA_FLOW_KEYS]) {
keymask = nla_get_u32(tb[TCA_FLOW_KEYS]);
- if (fls(keymask) - 1 > FLOW_KEY_MAX)
- return -EOPNOTSUPP;
nkeys = hweight32(keymask);
if (nkeys == 0)
return -EINVAL;
+
+ if (fls(keymask) - 1 > FLOW_KEY_MAX)
+ return -EOPNOTSUPP;
}
err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &flow_ext_map);