mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
[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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
0ea9d70df8
commit
4f25049106
1 changed files with 3 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue