Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net_sched: avoid casting void pointer

tp->root is a void* pointer, no need to cast it.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

WANG Cong and committed by
David S. Miller
a8701a6c 2519a602

+23 -26
+5 -5
net/sched/cls_basic.c
··· 38 38 struct tcf_result *res) 39 39 { 40 40 int r; 41 - struct basic_head *head = (struct basic_head *) tp->root; 41 + struct basic_head *head = tp->root; 42 42 struct basic_filter *f; 43 43 44 44 list_for_each_entry(f, &head->flist, link) { ··· 56 56 static unsigned long basic_get(struct tcf_proto *tp, u32 handle) 57 57 { 58 58 unsigned long l = 0UL; 59 - struct basic_head *head = (struct basic_head *) tp->root; 59 + struct basic_head *head = tp->root; 60 60 struct basic_filter *f; 61 61 62 62 if (head == NULL) ··· 107 107 108 108 static int basic_delete(struct tcf_proto *tp, unsigned long arg) 109 109 { 110 - struct basic_head *head = (struct basic_head *) tp->root; 110 + struct basic_head *head = tp->root; 111 111 struct basic_filter *t, *f = (struct basic_filter *) arg; 112 112 113 113 list_for_each_entry(t, &head->flist, link) ··· 164 164 struct nlattr **tca, unsigned long *arg) 165 165 { 166 166 int err; 167 - struct basic_head *head = (struct basic_head *) tp->root; 167 + struct basic_head *head = tp->root; 168 168 struct nlattr *tb[TCA_BASIC_MAX + 1]; 169 169 struct basic_filter *f = (struct basic_filter *) *arg; 170 170 ··· 225 225 226 226 static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg) 227 227 { 228 - struct basic_head *head = (struct basic_head *) tp->root; 228 + struct basic_head *head = tp->root; 229 229 struct basic_filter *f; 230 230 231 231 list_for_each_entry(f, &head->flist, link) {
+7 -7
net/sched/cls_fw.c
··· 75 75 static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, 76 76 struct tcf_result *res) 77 77 { 78 - struct fw_head *head = (struct fw_head *)tp->root; 78 + struct fw_head *head = tp->root; 79 79 struct fw_filter *f; 80 80 int r; 81 81 u32 id = skb->mark; ··· 111 111 112 112 static unsigned long fw_get(struct tcf_proto *tp, u32 handle) 113 113 { 114 - struct fw_head *head = (struct fw_head *)tp->root; 114 + struct fw_head *head = tp->root; 115 115 struct fw_filter *f; 116 116 117 117 if (head == NULL) ··· 160 160 161 161 static int fw_delete(struct tcf_proto *tp, unsigned long arg) 162 162 { 163 - struct fw_head *head = (struct fw_head *)tp->root; 163 + struct fw_head *head = tp->root; 164 164 struct fw_filter *f = (struct fw_filter *)arg; 165 165 struct fw_filter **fp; 166 166 ··· 190 190 fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, 191 191 struct nlattr **tb, struct nlattr **tca, unsigned long base) 192 192 { 193 - struct fw_head *head = (struct fw_head *)tp->root; 193 + struct fw_head *head = tp->root; 194 194 struct tcf_exts e; 195 195 u32 mask; 196 196 int err; ··· 237 237 struct nlattr **tca, 238 238 unsigned long *arg) 239 239 { 240 - struct fw_head *head = (struct fw_head *)tp->root; 240 + struct fw_head *head = tp->root; 241 241 struct fw_filter *f = (struct fw_filter *) *arg; 242 242 struct nlattr *opt = tca[TCA_OPTIONS]; 243 243 struct nlattr *tb[TCA_FW_MAX + 1]; ··· 300 300 301 301 static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg) 302 302 { 303 - struct fw_head *head = (struct fw_head *)tp->root; 303 + struct fw_head *head = tp->root; 304 304 int h; 305 305 306 306 if (head == NULL) ··· 329 329 static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, 330 330 struct sk_buff *skb, struct tcmsg *t) 331 331 { 332 - struct fw_head *head = (struct fw_head *)tp->root; 332 + struct fw_head *head = tp->root; 333 333 struct fw_filter *f = (struct fw_filter *)fh; 334 334 unsigned char *b = skb_tail_pointer(skb); 335 335 struct nlattr *nest;
+3 -3
net/sched/cls_route.c
··· 123 123 static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, 124 124 struct tcf_result *res) 125 125 { 126 - struct route4_head *head = (struct route4_head *)tp->root; 126 + struct route4_head *head = tp->root; 127 127 struct dst_entry *dst; 128 128 struct route4_bucket *b; 129 129 struct route4_filter *f; ··· 213 213 214 214 static unsigned long route4_get(struct tcf_proto *tp, u32 handle) 215 215 { 216 - struct route4_head *head = (struct route4_head *)tp->root; 216 + struct route4_head *head = tp->root; 217 217 struct route4_bucket *b; 218 218 struct route4_filter *f; 219 219 unsigned int h1, h2; ··· 284 284 285 285 static int route4_delete(struct tcf_proto *tp, unsigned long arg) 286 286 { 287 - struct route4_head *head = (struct route4_head *)tp->root; 287 + struct route4_head *head = tp->root; 288 288 struct route4_filter **fp, *f = (struct route4_filter *)arg; 289 289 unsigned int h = 0; 290 290 struct route4_bucket *b;
+7 -10
net/sched/cls_tcindex.c
··· 24 24 #define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */ 25 25 26 26 27 - #define PRIV(tp) ((struct tcindex_data *) (tp)->root) 28 - 29 - 30 27 struct tcindex_filter_result { 31 28 struct tcf_exts exts; 32 29 struct tcf_result res; ··· 74 77 static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp, 75 78 struct tcf_result *res) 76 79 { 77 - struct tcindex_data *p = PRIV(tp); 80 + struct tcindex_data *p = tp->root; 78 81 struct tcindex_filter_result *f; 79 82 int key = (skb->tc_index & p->mask) >> p->shift; 80 83 ··· 99 102 100 103 static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) 101 104 { 102 - struct tcindex_data *p = PRIV(tp); 105 + struct tcindex_data *p = tp->root; 103 106 struct tcindex_filter_result *r; 104 107 105 108 pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle); ··· 137 140 static int 138 141 __tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock) 139 142 { 140 - struct tcindex_data *p = PRIV(tp); 143 + struct tcindex_data *p = tp->root; 141 144 struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg; 142 145 struct tcindex_filter *f = NULL; 143 146 ··· 335 338 { 336 339 struct nlattr *opt = tca[TCA_OPTIONS]; 337 340 struct nlattr *tb[TCA_TCINDEX_MAX + 1]; 338 - struct tcindex_data *p = PRIV(tp); 341 + struct tcindex_data *p = tp->root; 339 342 struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; 340 343 int err; 341 344 ··· 357 360 358 361 static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) 359 362 { 360 - struct tcindex_data *p = PRIV(tp); 363 + struct tcindex_data *p = tp->root; 361 364 struct tcindex_filter *f, *next; 362 365 int i; 363 366 ··· 404 407 405 408 static void tcindex_destroy(struct tcf_proto *tp) 406 409 { 407 - struct tcindex_data *p = PRIV(tp); 410 + struct tcindex_data *p = tp->root; 408 411 struct tcf_walker walker; 409 412 410 413 pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p); ··· 422 425 static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, 423 426 struct sk_buff *skb, struct tcmsg *t) 424 427 { 425 - struct tcindex_data *p = PRIV(tp); 428 + struct tcindex_data *p = tp->root; 426 429 struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; 427 430 unsigned char *b = skb_tail_pointer(skb); 428 431 struct nlattr *nest;
+1 -1
net/sched/cls_u32.c
··· 95 95 unsigned int off; 96 96 } stack[TC_U32_MAXDEPTH]; 97 97 98 - struct tc_u_hnode *ht = (struct tc_u_hnode *)tp->root; 98 + struct tc_u_hnode *ht = tp->root; 99 99 unsigned int off = skb_network_offset(skb); 100 100 struct tc_u_knode *n; 101 101 int sdepth = 0;