diff options
-rw-r--r-- | net/sched/sch_dsmark.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index a9732aef2ca..d96eaf0aa6b 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/skbuff.h> | 11 | #include <linux/skbuff.h> |
12 | #include <linux/rtnetlink.h> | 12 | #include <linux/rtnetlink.h> |
13 | #include <linux/bitops.h> | ||
13 | #include <net/pkt_sched.h> | 14 | #include <net/pkt_sched.h> |
14 | #include <net/dsfield.h> | 15 | #include <net/dsfield.h> |
15 | #include <net/inet_ecn.h> | 16 | #include <net/inet_ecn.h> |
@@ -43,17 +44,6 @@ struct dsmark_qdisc_data { | |||
43 | int set_tc_index; | 44 | int set_tc_index; |
44 | }; | 45 | }; |
45 | 46 | ||
46 | static inline int dsmark_valid_indices(u16 indices) | ||
47 | { | ||
48 | while (indices != 1) { | ||
49 | if (indices & 1) | ||
50 | return 0; | ||
51 | indices >>= 1; | ||
52 | } | ||
53 | |||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index) | 47 | static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index) |
58 | { | 48 | { |
59 | return (index <= p->indices && index > 0); | 49 | return (index <= p->indices && index > 0); |
@@ -348,7 +338,8 @@ static int dsmark_init(struct Qdisc *sch, struct rtattr *opt) | |||
348 | goto errout; | 338 | goto errout; |
349 | 339 | ||
350 | indices = RTA_GET_U16(tb[TCA_DSMARK_INDICES-1]); | 340 | indices = RTA_GET_U16(tb[TCA_DSMARK_INDICES-1]); |
351 | if (!indices || !dsmark_valid_indices(indices)) | 341 | |
342 | if (hweight32(indices) != 1) | ||
352 | goto errout; | 343 | goto errout; |
353 | 344 | ||
354 | if (tb[TCA_DSMARK_DEFAULT_INDEX-1]) | 345 | if (tb[TCA_DSMARK_DEFAULT_INDEX-1]) |