Commit ea110733 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarPaul Moore <paul.moore@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@conan.davemloft.net>
parent 3c8def97
...@@ -231,7 +231,7 @@ static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -231,7 +231,7 @@ static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
dev = (struct net_device *)v; dev = v;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
dev = net_device_entry(&net->dev_base_head); dev = net_device_entry(&net->dev_base_head);
......
...@@ -1005,7 +1005,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, ...@@ -1005,7 +1005,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier,
struct mpoa_client *mpc; struct mpoa_client *mpc;
struct lec_priv *priv; struct lec_priv *priv;
dev = (struct net_device *)dev_ptr; dev = dev_ptr;
if (!net_eq(dev_net(dev), &init_net)) if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE; return NOTIFY_DONE;
......
...@@ -444,7 +444,7 @@ int ceph_key_instantiate(struct key *key, const void *data, size_t datalen) ...@@ -444,7 +444,7 @@ int ceph_key_instantiate(struct key *key, const void *data, size_t datalen)
goto err; goto err;
/* TODO ceph_crypto_key_decode should really take const input */ /* TODO ceph_crypto_key_decode should really take const input */
p = (void*)data; p = (void *)data;
ret = ceph_crypto_key_decode(ckey, &p, (char*)data+datalen); ret = ceph_crypto_key_decode(ckey, &p, (char*)data+datalen);
if (ret < 0) if (ret < 0)
goto err_ckey; goto err_ckey;
......
...@@ -1313,7 +1313,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1313,7 +1313,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
dev = (struct net_device *)v; dev = v;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
dev = net_device_entry(&init_net.dev_base_head); dev = net_device_entry(&init_net.dev_base_head);
......
...@@ -369,7 +369,7 @@ static void irda_getvalue_confirm(int result, __u16 obj_id, ...@@ -369,7 +369,7 @@ static void irda_getvalue_confirm(int result, __u16 obj_id,
{ {
struct irda_sock *self; struct irda_sock *self;
self = (struct irda_sock *) priv; self = priv;
if (!self) { if (!self) {
IRDA_WARNING("%s: lost myself!\n", __func__); IRDA_WARNING("%s: lost myself!\n", __func__);
return; return;
...@@ -418,7 +418,7 @@ static void irda_selective_discovery_indication(discinfo_t *discovery, ...@@ -418,7 +418,7 @@ static void irda_selective_discovery_indication(discinfo_t *discovery,
IRDA_DEBUG(2, "%s()\n", __func__); IRDA_DEBUG(2, "%s()\n", __func__);
self = (struct irda_sock *) priv; self = priv;
if (!self) { if (!self) {
IRDA_WARNING("%s: lost myself!\n", __func__); IRDA_WARNING("%s: lost myself!\n", __func__);
return; return;
......
...@@ -382,7 +382,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery, ...@@ -382,7 +382,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
info.daddr = discovery->daddr; info.daddr = discovery->daddr;
info.saddr = discovery->saddr; info.saddr = discovery->saddr;
self = (struct ircomm_tty_cb *) priv; self = priv;
ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
NULL, &info); NULL, &info);
} }
......
...@@ -262,7 +262,7 @@ static void irda_task_timer_expired(void *data) ...@@ -262,7 +262,7 @@ static void irda_task_timer_expired(void *data)
IRDA_DEBUG(2, "%s()\n", __func__); IRDA_DEBUG(2, "%s()\n", __func__);
task = (struct irda_task *) data; task = data;
irda_task_kick(task); irda_task_kick(task);
} }
......
...@@ -300,7 +300,7 @@ static void iriap_disconnect_indication(void *instance, void *sap, ...@@ -300,7 +300,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]); IRDA_DEBUG(4, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]);
self = (struct iriap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IAS_MAGIC, return;); IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
...@@ -754,7 +754,7 @@ static void iriap_connect_confirm(void *instance, void *sap, ...@@ -754,7 +754,7 @@ static void iriap_connect_confirm(void *instance, void *sap,
{ {
struct iriap_cb *self; struct iriap_cb *self;
self = (struct iriap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IAS_MAGIC, return;); IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
...@@ -786,7 +786,7 @@ static void iriap_connect_indication(void *instance, void *sap, ...@@ -786,7 +786,7 @@ static void iriap_connect_indication(void *instance, void *sap,
IRDA_DEBUG(1, "%s()\n", __func__); IRDA_DEBUG(1, "%s()\n", __func__);
self = (struct iriap_cb *) instance; self = instance;
IRDA_ASSERT(skb != NULL, return;); IRDA_ASSERT(skb != NULL, return;);
IRDA_ASSERT(self != NULL, goto out;); IRDA_ASSERT(self != NULL, goto out;);
...@@ -834,7 +834,7 @@ static int iriap_data_indication(void *instance, void *sap, ...@@ -834,7 +834,7 @@ static int iriap_data_indication(void *instance, void *sap,
IRDA_DEBUG(3, "%s()\n", __func__); IRDA_DEBUG(3, "%s()\n", __func__);
self = (struct iriap_cb *) instance; self = instance;
IRDA_ASSERT(skb != NULL, return 0;); IRDA_ASSERT(skb != NULL, return 0;);
IRDA_ASSERT(self != NULL, goto out;); IRDA_ASSERT(self != NULL, goto out;);
......
...@@ -198,7 +198,7 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, ...@@ -198,7 +198,7 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap,
IRDA_DEBUG(2, "%s()\n", __func__ ); IRDA_DEBUG(2, "%s()\n", __func__ );
self = (struct irlan_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
...@@ -226,8 +226,8 @@ static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, ...@@ -226,8 +226,8 @@ static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason); IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason);
self = (struct irlan_cb *) instance; self = instance;
tsap = (struct tsap_cb *) sap; tsap = sap;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
...@@ -298,7 +298,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, ...@@ -298,7 +298,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap,
IRDA_DEBUG(4, "%s()\n", __func__ ); IRDA_DEBUG(4, "%s()\n", __func__ );
self = (struct irlan_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
...@@ -542,7 +542,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, ...@@ -542,7 +542,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id,
IRDA_ASSERT(priv != NULL, return;); IRDA_ASSERT(priv != NULL, return;);
self = (struct irlan_cb *) priv; self = priv;
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
/* We probably don't need to make any more queries */ /* We probably don't need to make any more queries */
......
...@@ -317,8 +317,8 @@ static void irlan_connect_indication(void *instance, void *sap, ...@@ -317,8 +317,8 @@ static void irlan_connect_indication(void *instance, void *sap,
IRDA_DEBUG(2, "%s()\n", __func__ ); IRDA_DEBUG(2, "%s()\n", __func__ );
self = (struct irlan_cb *) instance; self = instance;
tsap = (struct tsap_cb *) sap; tsap = sap;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
...@@ -361,7 +361,7 @@ static void irlan_connect_confirm(void *instance, void *sap, ...@@ -361,7 +361,7 @@ static void irlan_connect_confirm(void *instance, void *sap,
{ {
struct irlan_cb *self; struct irlan_cb *self;
self = (struct irlan_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
...@@ -406,8 +406,8 @@ static void irlan_disconnect_indication(void *instance, ...@@ -406,8 +406,8 @@ static void irlan_disconnect_indication(void *instance,
IRDA_DEBUG(0, "%s(), reason=%d\n", __func__ , reason); IRDA_DEBUG(0, "%s(), reason=%d\n", __func__ , reason);
self = (struct irlan_cb *) instance; self = instance;
tsap = (struct tsap_cb *) sap; tsap = sap;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
......
...@@ -272,7 +272,7 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) ...@@ -272,7 +272,7 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
struct irlan_cb *self; struct irlan_cb *self;
struct net_device *dev; struct net_device *dev;
self = (struct irlan_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
......
...@@ -73,7 +73,7 @@ static int irlan_provider_data_indication(void *instance, void *sap, ...@@ -73,7 +73,7 @@ static int irlan_provider_data_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s()\n", __func__ ); IRDA_DEBUG(4, "%s()\n", __func__ );
self = (struct irlan_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
...@@ -131,8 +131,8 @@ static void irlan_provider_connect_indication(void *instance, void *sap, ...@@ -131,8 +131,8 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_DEBUG(0, "%s()\n", __func__ );
self = (struct irlan_cb *) instance; self = instance;
tsap = (struct tsap_cb *) sap; tsap = sap;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
...@@ -182,8 +182,8 @@ static void irlan_provider_disconnect_indication(void *instance, void *sap, ...@@ -182,8 +182,8 @@ static void irlan_provider_disconnect_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason); IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason);
self = (struct irlan_cb *) instance; self = instance;
tsap = (struct tsap_cb *) sap; tsap = sap;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
......
...@@ -780,7 +780,7 @@ void* hashbin_lock_find( hashbin_t* hashbin, long hashv, const char* name ) ...@@ -780,7 +780,7 @@ void* hashbin_lock_find( hashbin_t* hashbin, long hashv, const char* name )
/* /*
* Search for entry * Search for entry
*/ */
entry = (irda_queue_t* ) hashbin_find( hashbin, hashv, name ); entry = hashbin_find(hashbin, hashv, name);
/* Release lock */ /* Release lock */
spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); spin_unlock_irqrestore(&hashbin->hb_spinlock, flags);
...@@ -813,7 +813,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name, ...@@ -813,7 +813,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name,
* This allow to check if the current item is still in the * This allow to check if the current item is still in the
* hashbin or has been removed. * hashbin or has been removed.
*/ */
entry = (irda_queue_t* ) hashbin_find( hashbin, hashv, name ); entry = hashbin_find(hashbin, hashv, name);
/* /*
* Trick hashbin_get_next() to return what we want * Trick hashbin_get_next() to return what we want
......
...@@ -350,7 +350,7 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, ...@@ -350,7 +350,7 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
{ {
struct tsap_cb *self; struct tsap_cb *self;
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
...@@ -879,7 +879,7 @@ static int irttp_udata_indication(void *instance, void *sap, ...@@ -879,7 +879,7 @@ static int irttp_udata_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s()\n", __func__); IRDA_DEBUG(4, "%s()\n", __func__);
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
...@@ -914,7 +914,7 @@ static int irttp_data_indication(void *instance, void *sap, ...@@ -914,7 +914,7 @@ static int irttp_data_indication(void *instance, void *sap,
unsigned long flags; unsigned long flags;
int n; int n;
self = (struct tsap_cb *) instance; self = instance;
n = skb->data[0] & 0x7f; /* Extract the credits */ n = skb->data[0] & 0x7f; /* Extract the credits */
...@@ -996,7 +996,7 @@ static void irttp_status_indication(void *instance, ...@@ -996,7 +996,7 @@ static void irttp_status_indication(void *instance,
IRDA_DEBUG(4, "%s()\n", __func__); IRDA_DEBUG(4, "%s()\n", __func__);
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
...@@ -1025,7 +1025,7 @@ static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) ...@@ -1025,7 +1025,7 @@ static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
{ {
struct tsap_cb *self; struct tsap_cb *self;
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
...@@ -1208,7 +1208,7 @@ static void irttp_connect_confirm(void *instance, void *sap, ...@@ -1208,7 +1208,7 @@ static void irttp_connect_confirm(void *instance, void *sap,
IRDA_DEBUG(4, "%s()\n", __func__); IRDA_DEBUG(4, "%s()\n", __func__);
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
...@@ -1292,13 +1292,13 @@ static void irttp_connect_indication(void *instance, void *sap, ...@@ -1292,13 +1292,13 @@ static void irttp_connect_indication(void *instance, void *sap,
__u8 plen; __u8 plen;
__u8 n; __u8 n;
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
IRDA_ASSERT(skb != NULL, return;); IRDA_ASSERT(skb != NULL, return;);
lsap = (struct lsap_cb *) sap; lsap = sap;
self->max_seg_size = max_seg_size - TTP_HEADER; self->max_seg_size = max_seg_size - TTP_HEADER;
self->max_header_size = max_header_size+TTP_HEADER; self->max_header_size = max_header_size+TTP_HEADER;
...@@ -1602,7 +1602,7 @@ static void irttp_disconnect_indication(void *instance, void *sap, ...@@ -1602,7 +1602,7 @@ static void irttp_disconnect_indication(void *instance, void *sap,
IRDA_DEBUG(4, "%s()\n", __func__); IRDA_DEBUG(4, "%s()\n", __func__);
self = (struct tsap_cb *) instance; self = instance;
IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;); IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
......
...@@ -621,7 +621,7 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct net *net, const struct ...@@ -621,7 +621,7 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct net *net, const struct
unsigned short family; unsigned short family;
xfrm_address_t *xaddr; xfrm_address_t *xaddr;
sa = (const struct sadb_sa *) ext_hdrs[SADB_EXT_SA-1]; sa = ext_hdrs[SADB_EXT_SA - 1];
if (sa == NULL) if (sa == NULL)
return NULL; return NULL;
...@@ -630,7 +630,7 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct net *net, const struct ...@@ -630,7 +630,7 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct net *net, const struct
return NULL; return NULL;
/* sadb_address_len should be checked by caller */ /* sadb_address_len should be checked by caller */
addr = (const struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1]; addr = ext_hdrs[SADB_EXT_ADDRESS_DST - 1];
if (addr == NULL) if (addr == NULL)
return NULL; return NULL;
...@@ -1039,7 +1039,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, ...@@ -1039,7 +1039,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
int err; int err;
sa = (const struct sadb_sa *) ext_hdrs[SADB_EXT_SA-1]; sa = ext_hdrs[SADB_EXT_SA - 1];
if (!sa || if (!sa ||
!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1], !present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
ext_hdrs[SADB_EXT_ADDRESS_DST-1])) ext_hdrs[SADB_EXT_ADDRESS_DST-1]))
...@@ -1078,7 +1078,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, ...@@ -1078,7 +1078,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
sa->sadb_sa_encrypt > SADB_X_CALG_MAX) || sa->sadb_sa_encrypt > SADB_X_CALG_MAX) ||
sa->sadb_sa_encrypt > SADB_EALG_MAX) sa->sadb_sa_encrypt > SADB_EALG_MAX)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
key = (const struct sadb_key*) ext_hdrs[SADB_EXT_KEY_AUTH-1]; key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
if (key != NULL && if (key != NULL &&
sa->sadb_sa_auth != SADB_X_AALG_NULL && sa->sadb_sa_auth != SADB_X_AALG_NULL &&
((key->sadb_key_bits+7) / 8 == 0 || ((key->sadb_key_bits+7) / 8 == 0 ||
...@@ -1105,14 +1105,14 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, ...@@ -1105,14 +1105,14 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
if (sa->sadb_sa_flags & SADB_SAFLAGS_NOPMTUDISC) if (sa->sadb_sa_flags & SADB_SAFLAGS_NOPMTUDISC)
x->props.flags |= XFRM_STATE_NOPMTUDISC; x->props.flags |= XFRM_STATE_NOPMTUDISC;
lifetime = (const struct sadb_lifetime*) ext_hdrs[SADB_EXT_LIFETIME_HARD-1]; lifetime = ext_hdrs[SADB_EXT_LIFETIME_HARD - 1];
if (lifetime != NULL) { if (lifetime != NULL) {
x->lft.hard_packet_limit = _KEY2X(lifetime->sadb_lifetime_allocations); x->lft.hard_packet_limit = _KEY2X(lifetime->sadb_lifetime_allocations);
x->lft.hard_byte_limit = _KEY2X(lifetime->sadb_lifetime_bytes); x->lft.hard_byte_limit = _KEY2X(lifetime->sadb_lifetime_bytes);
x->lft.hard_add_expires_seconds = lifetime->sadb_lifetime_addtime; x->lft.hard_add_expires_seconds = lifetime->sadb_lifetime_addtime;
x->lft.hard_use_expires_seconds = lifetime->sadb_lifetime_usetime; x->lft.hard_use_expires_seconds = lifetime->sadb_lifetime_usetime;
} }
lifetime = (const struct sadb_lifetime*) ext_hdrs[SADB_EXT_LIFETIME_SOFT-1]; lifetime = ext_hdrs[SADB_EXT_LIFETIME_SOFT - 1];
if (lifetime != NULL) { if (lifetime != NULL) {
x->lft.soft_packet_limit = _KEY2X(lifetime->sadb_lifetime_allocations); x->lft.soft_packet_limit = _KEY2X(lifetime->sadb_lifetime_allocations);
x->lft.soft_byte_limit = _KEY2X(lifetime->sadb_lifetime_bytes); x->lft.soft_byte_limit = _KEY2X(lifetime->sadb_lifetime_bytes);
...@@ -1120,7 +1120,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, ...@@ -1120,7 +1120,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
x->lft.soft_use_expires_seconds = lifetime->sadb_lifetime_usetime; x->lft.soft_use_expires_seconds = lifetime->sadb_lifetime_usetime;
} }
sec_ctx = (const struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
if (sec_ctx != NULL) { if (sec_ctx != NULL) {
struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx);
...@@ -1134,7 +1134,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, ...@@ -1134,7 +1134,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
goto out; goto out;
} }
key = (const struct sadb_key*) ext_hdrs[SADB_EXT_KEY_AUTH-1]; key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
if (sa->sadb_sa_auth) { if (sa->sadb_sa_auth) {
int keysize = 0; int keysize = 0;
struct xfrm_algo_desc *a = xfrm_aalg_get_byid(sa->sadb_sa_auth); struct xfrm_algo_desc *a = xfrm_aalg_get_byid(sa->sadb_sa_auth);
...@@ -2219,7 +2219,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ ...@@ -2219,7 +2219,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
if (xp->selector.dport) if (xp->selector.dport)
xp->selector.dport_mask = htons(0xffff); xp->selector.dport_mask = htons(0xffff);
sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
if (sec_ctx != NULL) { if (sec_ctx != NULL) {
struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx);
...@@ -2323,7 +2323,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa ...@@ -2323,7 +2323,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa
if (sel.dport) if (sel.dport)
sel.dport_mask = htons(0xffff); sel.dport_mask = htons(0xffff);
sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1];
if (sec_ctx != NULL) { if (sec_ctx != NULL) {
struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx); struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx);
......
...@@ -426,10 +426,9 @@ int netlbl_unlhsh_add(struct net *net, ...@@ -426,10 +426,9 @@ int netlbl_unlhsh_add(struct net *net,
audit_info); audit_info);
switch (addr_len) { switch (addr_len) {
case sizeof(struct in_addr): { case sizeof(struct in_addr): {
struct in_addr *addr4, *mask4; const struct in_addr *addr4 = addr;
const struct in_addr *mask4 = mask;
addr4 = (struct in_addr *)addr;
mask4 = (struct in_addr *)mask;
ret_val = netlbl_unlhsh_add_addr4(iface, addr4, mask4, secid); ret_val = netlbl_unlhsh_add_addr4(iface, addr4, mask4, secid);
if (audit_buf != NULL) if (audit_buf != NULL)
netlbl_af4list_audit_addr(audit_buf, 1, netlbl_af4list_audit_addr(audit_buf, 1,
...@@ -440,10 +439,9 @@ int netlbl_unlhsh_add(struct net *net, ...@@ -440,10 +439,9 @@ int netlbl_unlhsh_add(struct net *net,
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case sizeof(struct in6_addr): { case sizeof(struct in6_addr): {
struct in6_addr *addr6, *mask6; const struct in6_addr *addr6 = addr;
const struct in6_addr *mask6 = mask;
addr6 = (struct in6_addr *)addr;
mask6 = (struct in6_addr *)mask;
ret_val = netlbl_unlhsh_add_addr6(iface, addr6, mask6, secid); ret_val = netlbl_unlhsh_add_addr6(iface, addr6, mask6, secid);
if (audit_buf != NULL) if (audit_buf != NULL)
netlbl_af6list_audit_addr(audit_buf, 1, netlbl_af6list_audit_addr(audit_buf, 1,
......
...@@ -430,7 +430,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, ...@@ -430,7 +430,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
list_for_each_entry(laddr, &bp->address_list, list) { list_for_each_entry(laddr, &bp->address_list, list) {
addr_buf = (union sctp_addr *)addrs; addr_buf = (union sctp_addr *)addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
addr = (union sctp_addr *)addr_buf; addr = addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family); af = sctp_get_af_specific(addr->v4.sin_family);
if (!af) if (!af)
break; break;
......
...@@ -510,8 +510,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, ...@@ -510,8 +510,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
* discard the packet. * discard the packet.
*/ */
if (vtag == 0) { if (vtag == 0) {
chunkhdr = (struct sctp_init_chunk *)((void *)sctphdr chunkhdr = (void *)sctphdr + sizeof(struct sctphdr);
+ sizeof(struct sctphdr));
if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t) if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t)
+ sizeof(__be32) || + sizeof(__be32) ||
chunkhdr->chunk_hdr.type != SCTP_CID_INIT || chunkhdr->chunk_hdr.type != SCTP_CID_INIT ||
......
...@@ -2773,7 +2773,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, ...@@ -2773,7 +2773,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
/* Get total length of all the address parameters. */ /* Get total length of all the address parameters. */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
addr = (union sctp_addr *)addr_buf; addr = addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family); af = sctp_get_af_specific(addr->v4.sin_family);
addr_param_len = af->to_addr_param(addr, &addr_param); addr_param_len = af->to_addr_param(addr, &addr_param);
...@@ -2798,7 +2798,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, ...@@ -2798,7 +2798,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
/* Add the address parameters to the asconf chunk. */ /* Add the address parameters to the asconf chunk. */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
addr = (union sctp_addr *)addr_buf; addr = addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family); af = sctp_get_af_specific(addr->v4.sin_family);
addr_param_len = af->to_addr_param(addr, &addr_param); addr_param_len = af->to_addr_param(addr, &addr_param);
param.param_hdr.type = flags; param.param_hdr.type = flags;
...@@ -2958,8 +2958,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, ...@@ -2958,8 +2958,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
union sctp_addr addr; union sctp_addr addr;
union sctp_addr_param *addr_param; union sctp_addr_param *addr_param;
addr_param = (union sctp_addr_param *) addr_param = (void *)asconf_param + sizeof(sctp_addip_param_t);
((void *)asconf_param + sizeof(sctp_addip_param_t));
if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP && if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP &&
asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP && asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP &&
...@@ -3144,7 +3143,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, ...@@ -3144,7 +3143,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
* asconf parameter. * asconf parameter.
*/ */
length = ntohs(addr_param->p.length); length = ntohs(addr_param->p.length);
asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); asconf_param = (void *)addr_param + length;
chunk_len -= length; chunk_len -= length;
/* create an ASCONF_ACK chunk. /* create an ASCONF_ACK chunk.
...@@ -3185,8 +3184,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, ...@@ -3185,8 +3184,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
/* Move to the next ASCONF param. */ /* Move to the next ASCONF param. */
length = ntohs(asconf_param->param_hdr.length); length = ntohs(asconf_param->param_hdr.length);
asconf_param = (sctp_addip_param_t *)((void *)asconf_param + asconf_param = (void *)asconf_param + length;
length);
chunk_len -= length; chunk_len -= length;
} }
...@@ -3216,8 +3214,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc, ...@@ -3216,8 +3214,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,
struct sctp_transport *transport; struct sctp_transport *transport;
struct sctp_sockaddr_entry *saddr; struct sctp_sockaddr_entry *saddr;
addr_param = (union sctp_addr_param *) addr_param = (void *)asconf_param + sizeof(sctp_addip_param_t);
((void *)asconf_param + sizeof(sctp_addip_param_t));
/* We have checked the packet before, so we do not check again. */ /* We have checked the packet before, so we do not check again. */
af = sctp_get_af_specific(param_type2af(addr_param->p.type)); 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,8 +3299,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
return SCTP_ERROR_NO_ERROR; return SCTP_ERROR_NO_ERROR;
case SCTP_PARAM_ERR_CAUSE: case SCTP_PARAM_ERR_CAUSE:
length = sizeof(sctp_addip_param_t); length = sizeof(sctp_addip_param_t);
err_param = (sctp_errhdr_t *) err_param = (void *)asconf_ack_param + length;
((void *)asconf_ack_param + length);
asconf_ack_len -= length; asconf_ack_len -= length;
if (asconf_ack_len > 0) if (asconf_ack_len > 0)
return err_param->cause; return err_param->cause;
...@@ -3316,8 +3312,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, ...@@ -3316,8 +3312,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
} }
length = ntohs(asconf_ack_param->param_hdr.length); length = ntohs(asconf_ack_param->param_hdr.length);
asconf_ack_param = (sctp_addip_param_t *) asconf_ack_param = (void *)asconf_ack_param + length;
((void *)asconf_ack_param + length);
asconf_ack_len -= length; asconf_ack_len -= length;
} }
...@@ -3349,7 +3344,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, ...@@ -3349,7 +3344,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
* pointer to the first asconf parameter. * pointer to the first asconf parameter.
*/ */
length = ntohs(addr_param->p.length); length = ntohs(addr_param->p.length);
asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); asconf_param = (void *)addr_param + length;
asconf_len -= length; asconf_len -= length;
/* ADDIP 4.1 /* ADDIP 4.1
...@@ -3400,8 +3395,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, ...@@ -3400,8 +3395,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
* one. * one.
*/ */
length = ntohs(asconf_param->param_hdr.length); length = ntohs(asconf_param->param_hdr.length);
asconf_param = (sctp_addip_param_t *)((void *)asconf_param + asconf_param = (void *)asconf_param + length;
length);
asconf_len -= length; asconf_len -= length;
} }
......
...@@ -1201,7 +1201,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, ...@@ -1201,7 +1201,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
int local_cork = 0; int local_cork = 0;
if (SCTP_EVENT_T_TIMEOUT != event_type) if (SCTP_EVENT_T_TIMEOUT != event_type)
chunk = (struct sctp_chunk *) event_arg; chunk = event_arg;
/* Note: This whole file is a huge candidate for rework. /* Note: This whole file is a huge candidate for rework.
* For example, each command could either have its own handler, so * For example, each command could either have its own handler, so
......
...@@ -476,7 +476,7 @@ static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) ...@@ -476,7 +476,7 @@ static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
/* The list may contain either IPv4 or IPv6 address; /* The list may contain either IPv4 or IPv6 address;
* determine the address length for walking thru the list. * determine the address length for walking thru the list.
*/ */
sa_addr = (struct sockaddr *)addr_buf; sa_addr = addr_buf;
af = sctp_get_af_specific(sa_addr->sa_family); af = sctp_get_af_specific(sa_addr->sa_family);
if (!af) { if (!af) {
retval = -EINVAL; retval = -EINVAL;
...@@ -555,7 +555,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk, ...@@ -555,7 +555,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk,
*/ */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
addr = (union sctp_addr *)addr_buf; addr = addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family); af = sctp_get_af_specific(addr->v4.sin_family);
if (!af) { if (!af) {
retval = -EINVAL; retval = -EINVAL;
...@@ -588,7 +588,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk, ...@@ -588,7 +588,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk,
*/ */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
addr = (union sctp_addr *)addr_buf; addr = addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family); af = sctp_get_af_specific(addr->v4.sin_family);
memcpy(&saveaddr, addr, af->sockaddr_len); memcpy(&saveaddr, addr, af->sockaddr_len);
retval = sctp_add_bind_addr(bp, &saveaddr, 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,7 +659,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
goto err_bindx_rem; goto err_bindx_rem;
} }
sa_addr = (union sctp_addr *)addr_buf; sa_addr = addr_buf;
af = sctp_get_af_specific(sa_addr->sa.sa_family); af = sctp_get_af_specific(sa_addr->sa.sa_family);
if (!af) { if (!af) {
retval = -EINVAL; retval = -EINVAL;
...@@ -758,7 +758,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk, ...@@ -758,7 +758,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
*/ */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
laddr = (union sctp_addr *)addr_buf; laddr = addr_buf;
af = sctp_get_af_specific(laddr->v4.sin_family); af = sctp_get_af_specific(laddr->v4.sin_family);
if (!af) { if (!af) {
retval = -EINVAL; retval = -EINVAL;
...@@ -830,7 +830,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk, ...@@ -830,7 +830,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
*/ */
addr_buf = addrs; addr_buf = addrs;
for (i = 0; i < addrcnt; i++) { for (i = 0; i < addrcnt; i++) {
laddr = (union sctp_addr *)addr_buf; laddr = addr_buf;
af = sctp_get_af_specific(laddr->v4.sin_family); af = sctp_get_af_specific(laddr->v4.sin_family);
list_for_each_entry(saddr, &bp->address_list, list) { list_for_each_entry(saddr, &bp->address_list, list) {
if (sctp_cmp_addr_exact(&saddr->a, laddr)) if (sctp_cmp_addr_exact(&saddr->a, laddr))
...@@ -997,7 +997,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, ...@@ -997,7 +997,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk,
return -EINVAL; return -EINVAL;
} }
sa_addr = (struct sockaddr *)addr_buf; sa_addr = addr_buf;
af = sctp_get_af_specific(sa_addr->sa_family); af = sctp_get_af_specific(sa_addr->sa_family);
/* If the address family is not supported or if this address /* If the address family is not supported or if this address
...@@ -1088,7 +1088,7 @@ static int __sctp_connect(struct sock* sk, ...@@ -1088,7 +1088,7 @@ static int __sctp_connect(struct sock* sk,
goto out_free; goto out_free;
} }
sa_addr = (union sctp_addr *)addr_buf; sa_addr = addr_buf;
af = sctp_get_af_specific(sa_addr->sa.sa_family); af = sctp_get_af_specific(sa_addr->sa.sa_family);
/* If the address family is not supported or if this address /* If the address family is not supported or if this address
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment