diff options
author | Joe Perches <joe@perches.com> | 2011-06-13 12:21:26 -0400 |
---|---|---|
committer | David S. Miller <davem@conan.davemloft.net> | 2011-06-16 23:19:27 -0400 |
commit | ea110733874d5176cb56dcf612a629ffac09dbf0 (patch) | |
tree | d079bb9990ecf7dadc326b62605fb4de1f6fad4f /net/sctp | |
parent | 3c8def9776c3d4636291432522ea312f7a44be95 (diff) |
net: Remove casts of void *
Unnecessary casts of void * clutter the code.
These are the remainder casts after several specific
patches to remove netdev_priv and dev_priv.
Done via coccinelle script:
$ cat cast_void_pointer.cocci
@@
type T;
T *pt;
void *pv;
@@
- pt = (T *)pv;
+ pt = pv;
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@conan.davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/bind_addr.c | 2 | ||||
-rw-r--r-- | net/sctp/input.c | 3 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 26 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 16 |
5 files changed, 21 insertions, 28 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index 17d157325b66..4ece451c8d27 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -430,7 +430,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | |||
430 | list_for_each_entry(laddr, &bp->address_list, list) { | 430 | list_for_each_entry(laddr, &bp->address_list, list) { |
431 | addr_buf = (union sctp_addr *)addrs; | 431 | addr_buf = (union sctp_addr *)addrs; |
432 | for (i = 0; i < addrcnt; i++) { | 432 | for (i = 0; i < addrcnt; i++) { |
433 | addr = (union sctp_addr *)addr_buf; | 433 | addr = addr_buf; |
434 | af = sctp_get_af_specific(addr->v4.sin_family); | 434 | af = sctp_get_af_specific(addr->v4.sin_family); |
435 | if (!af) | 435 | if (!af) |
436 | break; | 436 | break; |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 741ed1648838..b7692aab6e9c 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -510,8 +510,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
510 | * discard the packet. | 510 | * discard the packet. |
511 | */ | 511 | */ |
512 | if (vtag == 0) { | 512 | if (vtag == 0) { |
513 | chunkhdr = (struct sctp_init_chunk *)((void *)sctphdr | 513 | chunkhdr = (void *)sctphdr + sizeof(struct sctphdr); |
514 | + sizeof(struct sctphdr)); | ||
515 | if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t) | 514 | if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t) |
516 | + sizeof(__be32) || | 515 | + sizeof(__be32) || |
517 | chunkhdr->chunk_hdr.type != SCTP_CID_INIT || | 516 | chunkhdr->chunk_hdr.type != SCTP_CID_INIT || |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 3363d3788259..81db4e385352 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2773,7 +2773,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2773 | /* Get total length of all the address parameters. */ | 2773 | /* Get total length of all the address parameters. */ |
2774 | addr_buf = addrs; | 2774 | addr_buf = addrs; |
2775 | for (i = 0; i < addrcnt; i++) { | 2775 | for (i = 0; i < addrcnt; i++) { |
2776 | addr = (union sctp_addr *)addr_buf; | 2776 | addr = addr_buf; |
2777 | af = sctp_get_af_specific(addr->v4.sin_family); | 2777 | af = sctp_get_af_specific(addr->v4.sin_family); |
2778 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2778 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2779 | 2779 | ||
@@ -2798,7 +2798,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2798 | /* Add the address parameters to the asconf chunk. */ | 2798 | /* Add the address parameters to the asconf chunk. */ |
2799 | addr_buf = addrs; | 2799 | addr_buf = addrs; |
2800 | for (i = 0; i < addrcnt; i++) { | 2800 | for (i = 0; i < addrcnt; i++) { |
2801 | addr = (union sctp_addr *)addr_buf; | 2801 | addr = addr_buf; |
2802 | af = sctp_get_af_specific(addr->v4.sin_family); | 2802 | af = sctp_get_af_specific(addr->v4.sin_family); |
2803 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2803 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2804 | param.param_hdr.type = flags; | 2804 | param.param_hdr.type = flags; |
@@ -2958,8 +2958,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, | |||
2958 | union sctp_addr addr; | 2958 | union sctp_addr addr; |
2959 | union sctp_addr_param *addr_param; | 2959 | union sctp_addr_param *addr_param; |
2960 | 2960 | ||
2961 | addr_param = (union sctp_addr_param *) | 2961 | addr_param = (void *)asconf_param + sizeof(sctp_addip_param_t); |
2962 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); | ||
2963 | 2962 | ||
2964 | if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP && | 2963 | if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP && |
2965 | asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP && | 2964 | asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP && |
@@ -3144,7 +3143,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, | |||
3144 | * asconf parameter. | 3143 | * asconf parameter. |
3145 | */ | 3144 | */ |
3146 | length = ntohs(addr_param->p.length); | 3145 | length = ntohs(addr_param->p.length); |
3147 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); | 3146 | asconf_param = (void *)addr_param + length; |
3148 | chunk_len -= length; | 3147 | chunk_len -= length; |
3149 | 3148 | ||
3150 | /* create an ASCONF_ACK chunk. | 3149 | /* create an ASCONF_ACK chunk. |
@@ -3185,8 +3184,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, | |||
3185 | 3184 | ||
3186 | /* Move to the next ASCONF param. */ | 3185 | /* Move to the next ASCONF param. */ |
3187 | length = ntohs(asconf_param->param_hdr.length); | 3186 | length = ntohs(asconf_param->param_hdr.length); |
3188 | asconf_param = (sctp_addip_param_t *)((void *)asconf_param + | 3187 | asconf_param = (void *)asconf_param + length; |
3189 | length); | ||
3190 | chunk_len -= length; | 3188 | chunk_len -= length; |
3191 | } | 3189 | } |
3192 | 3190 | ||
@@ -3216,8 +3214,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc, | |||
3216 | struct sctp_transport *transport; | 3214 | struct sctp_transport *transport; |
3217 | struct sctp_sockaddr_entry *saddr; | 3215 | struct sctp_sockaddr_entry *saddr; |
3218 | 3216 | ||
3219 | addr_param = (union sctp_addr_param *) | 3217 | addr_param = (void *)asconf_param + sizeof(sctp_addip_param_t); |
3220 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); | ||
3221 | 3218 | ||
3222 | /* We have checked the packet before, so we do not check again. */ | 3219 | /* We have checked the packet before, so we do not check again. */ |
3223 | af = sctp_get_af_specific(param_type2af(addr_param->p.type)); | 3220 | af = sctp_get_af_specific(param_type2af(addr_param->p.type)); |
@@ -3302,8 +3299,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
3302 | return SCTP_ERROR_NO_ERROR; | 3299 | return SCTP_ERROR_NO_ERROR; |
3303 | case SCTP_PARAM_ERR_CAUSE: | 3300 | case SCTP_PARAM_ERR_CAUSE: |
3304 | length = sizeof(sctp_addip_param_t); | 3301 | length = sizeof(sctp_addip_param_t); |
3305 | err_param = (sctp_errhdr_t *) | 3302 | err_param = (void *)asconf_ack_param + length; |
3306 | ((void *)asconf_ack_param + length); | ||
3307 | asconf_ack_len -= length; | 3303 | asconf_ack_len -= length; |
3308 | if (asconf_ack_len > 0) | 3304 | if (asconf_ack_len > 0) |
3309 | return err_param->cause; | 3305 | return err_param->cause; |
@@ -3316,8 +3312,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
3316 | } | 3312 | } |
3317 | 3313 | ||
3318 | length = ntohs(asconf_ack_param->param_hdr.length); | 3314 | length = ntohs(asconf_ack_param->param_hdr.length); |
3319 | asconf_ack_param = (sctp_addip_param_t *) | 3315 | asconf_ack_param = (void *)asconf_ack_param + length; |
3320 | ((void *)asconf_ack_param + length); | ||
3321 | asconf_ack_len -= length; | 3316 | asconf_ack_len -= length; |
3322 | } | 3317 | } |
3323 | 3318 | ||
@@ -3349,7 +3344,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
3349 | * pointer to the first asconf parameter. | 3344 | * pointer to the first asconf parameter. |
3350 | */ | 3345 | */ |
3351 | length = ntohs(addr_param->p.length); | 3346 | length = ntohs(addr_param->p.length); |
3352 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); | 3347 | asconf_param = (void *)addr_param + length; |
3353 | asconf_len -= length; | 3348 | asconf_len -= length; |
3354 | 3349 | ||
3355 | /* ADDIP 4.1 | 3350 | /* ADDIP 4.1 |
@@ -3400,8 +3395,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
3400 | * one. | 3395 | * one. |
3401 | */ | 3396 | */ |
3402 | length = ntohs(asconf_param->param_hdr.length); | 3397 | length = ntohs(asconf_param->param_hdr.length); |
3403 | asconf_param = (sctp_addip_param_t *)((void *)asconf_param + | 3398 | asconf_param = (void *)asconf_param + length; |
3404 | length); | ||
3405 | asconf_len -= length; | 3399 | asconf_len -= length; |
3406 | } | 3400 | } |
3407 | 3401 | ||
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 534c2e5feb05..1b2bb6487342 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1201,7 +1201,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1201 | int local_cork = 0; | 1201 | int local_cork = 0; |
1202 | 1202 | ||
1203 | if (SCTP_EVENT_T_TIMEOUT != event_type) | 1203 | if (SCTP_EVENT_T_TIMEOUT != event_type) |
1204 | chunk = (struct sctp_chunk *) event_arg; | 1204 | chunk = event_arg; |
1205 | 1205 | ||
1206 | /* Note: This whole file is a huge candidate for rework. | 1206 | /* Note: This whole file is a huge candidate for rework. |
1207 | * For example, each command could either have its own handler, so | 1207 | * For example, each command could either have its own handler, so |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 60038fef3ba1..fd31b3616a33 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -476,7 +476,7 @@ static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
476 | /* The list may contain either IPv4 or IPv6 address; | 476 | /* The list may contain either IPv4 or IPv6 address; |
477 | * determine the address length for walking thru the list. | 477 | * determine the address length for walking thru the list. |
478 | */ | 478 | */ |
479 | sa_addr = (struct sockaddr *)addr_buf; | 479 | sa_addr = addr_buf; |
480 | af = sctp_get_af_specific(sa_addr->sa_family); | 480 | af = sctp_get_af_specific(sa_addr->sa_family); |
481 | if (!af) { | 481 | if (!af) { |
482 | retval = -EINVAL; | 482 | retval = -EINVAL; |
@@ -555,7 +555,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk, | |||
555 | */ | 555 | */ |
556 | addr_buf = addrs; | 556 | addr_buf = addrs; |
557 | for (i = 0; i < addrcnt; i++) { | 557 | for (i = 0; i < addrcnt; i++) { |
558 | addr = (union sctp_addr *)addr_buf; | 558 | addr = addr_buf; |
559 | af = sctp_get_af_specific(addr->v4.sin_family); | 559 | af = sctp_get_af_specific(addr->v4.sin_family); |
560 | if (!af) { | 560 | if (!af) { |
561 | retval = -EINVAL; | 561 | retval = -EINVAL; |
@@ -588,7 +588,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk, | |||
588 | */ | 588 | */ |
589 | addr_buf = addrs; | 589 | addr_buf = addrs; |
590 | for (i = 0; i < addrcnt; i++) { | 590 | for (i = 0; i < addrcnt; i++) { |
591 | addr = (union sctp_addr *)addr_buf; | 591 | addr = addr_buf; |
592 | af = sctp_get_af_specific(addr->v4.sin_family); | 592 | af = sctp_get_af_specific(addr->v4.sin_family); |
593 | memcpy(&saveaddr, addr, af->sockaddr_len); | 593 | memcpy(&saveaddr, addr, af->sockaddr_len); |
594 | retval = sctp_add_bind_addr(bp, &saveaddr, | 594 | retval = sctp_add_bind_addr(bp, &saveaddr, |
@@ -659,7 +659,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
659 | goto err_bindx_rem; | 659 | goto err_bindx_rem; |
660 | } | 660 | } |
661 | 661 | ||
662 | sa_addr = (union sctp_addr *)addr_buf; | 662 | sa_addr = addr_buf; |
663 | af = sctp_get_af_specific(sa_addr->sa.sa_family); | 663 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
664 | if (!af) { | 664 | if (!af) { |
665 | retval = -EINVAL; | 665 | retval = -EINVAL; |
@@ -758,7 +758,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
758 | */ | 758 | */ |
759 | addr_buf = addrs; | 759 | addr_buf = addrs; |
760 | for (i = 0; i < addrcnt; i++) { | 760 | for (i = 0; i < addrcnt; i++) { |
761 | laddr = (union sctp_addr *)addr_buf; | 761 | laddr = addr_buf; |
762 | af = sctp_get_af_specific(laddr->v4.sin_family); | 762 | af = sctp_get_af_specific(laddr->v4.sin_family); |
763 | if (!af) { | 763 | if (!af) { |
764 | retval = -EINVAL; | 764 | retval = -EINVAL; |
@@ -830,7 +830,7 @@ skip_mkasconf: | |||
830 | */ | 830 | */ |
831 | addr_buf = addrs; | 831 | addr_buf = addrs; |
832 | for (i = 0; i < addrcnt; i++) { | 832 | for (i = 0; i < addrcnt; i++) { |
833 | laddr = (union sctp_addr *)addr_buf; | 833 | laddr = addr_buf; |
834 | af = sctp_get_af_specific(laddr->v4.sin_family); | 834 | af = sctp_get_af_specific(laddr->v4.sin_family); |
835 | list_for_each_entry(saddr, &bp->address_list, list) { | 835 | list_for_each_entry(saddr, &bp->address_list, list) { |
836 | if (sctp_cmp_addr_exact(&saddr->a, laddr)) | 836 | if (sctp_cmp_addr_exact(&saddr->a, laddr)) |
@@ -997,7 +997,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, | |||
997 | return -EINVAL; | 997 | return -EINVAL; |
998 | } | 998 | } |
999 | 999 | ||
1000 | sa_addr = (struct sockaddr *)addr_buf; | 1000 | sa_addr = addr_buf; |
1001 | af = sctp_get_af_specific(sa_addr->sa_family); | 1001 | af = sctp_get_af_specific(sa_addr->sa_family); |
1002 | 1002 | ||
1003 | /* If the address family is not supported or if this address | 1003 | /* If the address family is not supported or if this address |
@@ -1088,7 +1088,7 @@ static int __sctp_connect(struct sock* sk, | |||
1088 | goto out_free; | 1088 | goto out_free; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | sa_addr = (union sctp_addr *)addr_buf; | 1091 | sa_addr = addr_buf; |
1092 | af = sctp_get_af_specific(sa_addr->sa.sa_family); | 1092 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
1093 | 1093 | ||
1094 | /* If the address family is not supported or if this address | 1094 | /* If the address family is not supported or if this address |