diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-06-16 08:29:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-16 11:48:39 -0400 |
commit | 4df864c1d9afb46e2461a9f808d9f11a42d31bad (patch) | |
tree | 07e7b3d16b161e0d199c5b8116df277798566e4f /net | |
parent | 59ae1d127ac0ae404baf414c434ba2651b793f46 (diff) |
networking: make skb_put & friends return void pointers
It seems like a historic accident that these return unsigned char *,
and in many places that means casts are required, more often than not.
Make these functions (skb_put, __skb_put and pskb_put) return void *
and remove all the casts across the tree, adding a (u8 *) cast only
where the unsigned char pointer was used directly, all done with the
following spatch:
@@
expression SKB, LEN;
typedef u8;
identifier fn = { skb_put, __skb_put };
@@
- *(fn(SKB, LEN))
+ *(u8 *)fn(SKB, LEN)
@@
expression E, SKB, LEN;
identifier fn = { skb_put, __skb_put };
type T;
@@
- E = ((T *)(fn(SKB, LEN)))
+ E = fn(SKB, LEN)
which actually doesn't cover pskb_put since there are only three
users overall.
A handful of stragglers were converted manually, notably a macro in
drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
instances in net/bluetooth/hci_sock.c. In the former file, I also
had to fix one whitespace problem spatch introduced.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
52 files changed, 199 insertions, 226 deletions
diff --git a/net/802/garp.c b/net/802/garp.c index b38ee6dcba45..a9a266569293 100644 --- a/net/802/garp.c +++ b/net/802/garp.c | |||
@@ -221,7 +221,7 @@ static int garp_pdu_init(struct garp_applicant *app) | |||
221 | skb->protocol = htons(ETH_P_802_2); | 221 | skb->protocol = htons(ETH_P_802_2); |
222 | skb_reserve(skb, LL_RESERVED_SPACE(app->dev) + LLC_RESERVE); | 222 | skb_reserve(skb, LL_RESERVED_SPACE(app->dev) + LLC_RESERVE); |
223 | 223 | ||
224 | gp = (struct garp_pdu_hdr *)__skb_put(skb, sizeof(*gp)); | 224 | gp = __skb_put(skb, sizeof(*gp)); |
225 | put_unaligned(htons(GARP_PROTOCOL_ID), &gp->protocol); | 225 | put_unaligned(htons(GARP_PROTOCOL_ID), &gp->protocol); |
226 | 226 | ||
227 | app->pdu = skb; | 227 | app->pdu = skb; |
@@ -268,7 +268,7 @@ static int garp_pdu_append_msg(struct garp_applicant *app, u8 attrtype) | |||
268 | 268 | ||
269 | if (skb_tailroom(app->pdu) < sizeof(*gm)) | 269 | if (skb_tailroom(app->pdu) < sizeof(*gm)) |
270 | return -1; | 270 | return -1; |
271 | gm = (struct garp_msg_hdr *)__skb_put(app->pdu, sizeof(*gm)); | 271 | gm = __skb_put(app->pdu, sizeof(*gm)); |
272 | gm->attrtype = attrtype; | 272 | gm->attrtype = attrtype; |
273 | garp_cb(app->pdu)->cur_type = attrtype; | 273 | garp_cb(app->pdu)->cur_type = attrtype; |
274 | return 0; | 274 | return 0; |
@@ -299,7 +299,7 @@ again: | |||
299 | len = sizeof(*ga) + attr->dlen; | 299 | len = sizeof(*ga) + attr->dlen; |
300 | if (skb_tailroom(app->pdu) < len) | 300 | if (skb_tailroom(app->pdu) < len) |
301 | goto queue; | 301 | goto queue; |
302 | ga = (struct garp_attr_hdr *)__skb_put(app->pdu, len); | 302 | ga = __skb_put(app->pdu, len); |
303 | ga->len = len; | 303 | ga->len = len; |
304 | ga->event = event; | 304 | ga->event = event; |
305 | memcpy(ga->data, attr->data, attr->dlen); | 305 | memcpy(ga->data, attr->data, attr->dlen); |
diff --git a/net/802/mrp.c b/net/802/mrp.c index 72db2785ef2c..be4dd3165347 100644 --- a/net/802/mrp.c +++ b/net/802/mrp.c | |||
@@ -311,7 +311,7 @@ static int mrp_pdu_init(struct mrp_applicant *app) | |||
311 | skb_reset_network_header(skb); | 311 | skb_reset_network_header(skb); |
312 | skb_reset_transport_header(skb); | 312 | skb_reset_transport_header(skb); |
313 | 313 | ||
314 | ph = (struct mrp_pdu_hdr *)__skb_put(skb, sizeof(*ph)); | 314 | ph = __skb_put(skb, sizeof(*ph)); |
315 | ph->version = app->app->version; | 315 | ph->version = app->app->version; |
316 | 316 | ||
317 | app->pdu = skb; | 317 | app->pdu = skb; |
@@ -324,7 +324,7 @@ static int mrp_pdu_append_end_mark(struct mrp_applicant *app) | |||
324 | 324 | ||
325 | if (skb_tailroom(app->pdu) < sizeof(*endmark)) | 325 | if (skb_tailroom(app->pdu) < sizeof(*endmark)) |
326 | return -1; | 326 | return -1; |
327 | endmark = (__be16 *)__skb_put(app->pdu, sizeof(*endmark)); | 327 | endmark = __skb_put(app->pdu, sizeof(*endmark)); |
328 | put_unaligned(MRP_END_MARK, endmark); | 328 | put_unaligned(MRP_END_MARK, endmark); |
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
@@ -368,7 +368,7 @@ static int mrp_pdu_append_msg_hdr(struct mrp_applicant *app, | |||
368 | 368 | ||
369 | if (skb_tailroom(app->pdu) < sizeof(*mh)) | 369 | if (skb_tailroom(app->pdu) < sizeof(*mh)) |
370 | return -1; | 370 | return -1; |
371 | mh = (struct mrp_msg_hdr *)__skb_put(app->pdu, sizeof(*mh)); | 371 | mh = __skb_put(app->pdu, sizeof(*mh)); |
372 | mh->attrtype = attrtype; | 372 | mh->attrtype = attrtype; |
373 | mh->attrlen = attrlen; | 373 | mh->attrlen = attrlen; |
374 | mrp_cb(app->pdu)->mh = mh; | 374 | mrp_cb(app->pdu)->mh = mh; |
@@ -382,8 +382,7 @@ static int mrp_pdu_append_vecattr_hdr(struct mrp_applicant *app, | |||
382 | 382 | ||
383 | if (skb_tailroom(app->pdu) < sizeof(*vah) + attrlen) | 383 | if (skb_tailroom(app->pdu) < sizeof(*vah) + attrlen) |
384 | return -1; | 384 | return -1; |
385 | vah = (struct mrp_vecattr_hdr *)__skb_put(app->pdu, | 385 | vah = __skb_put(app->pdu, sizeof(*vah) + attrlen); |
386 | sizeof(*vah) + attrlen); | ||
387 | put_unaligned(0, &vah->lenflags); | 386 | put_unaligned(0, &vah->lenflags); |
388 | memcpy(vah->firstattrvalue, firstattrvalue, attrlen); | 387 | memcpy(vah->firstattrvalue, firstattrvalue, attrlen); |
389 | mrp_cb(app->pdu)->vah = vah; | 388 | mrp_cb(app->pdu)->vah = vah; |
@@ -435,7 +434,7 @@ again: | |||
435 | if (!pos) { | 434 | if (!pos) { |
436 | if (skb_tailroom(app->pdu) < sizeof(u8)) | 435 | if (skb_tailroom(app->pdu) < sizeof(u8)) |
437 | goto queue; | 436 | goto queue; |
438 | vaevents = (u8 *)__skb_put(app->pdu, sizeof(u8)); | 437 | vaevents = __skb_put(app->pdu, sizeof(u8)); |
439 | } else { | 438 | } else { |
440 | vaevents = (u8 *)(skb_tail_pointer(app->pdu) - sizeof(u8)); | 439 | vaevents = (u8 *)(skb_tail_pointer(app->pdu) - sizeof(u8)); |
441 | } | 440 | } |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 465cc24b41e5..c7af6dc70fa2 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1647,7 +1647,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) | |||
1647 | 1647 | ||
1648 | SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); | 1648 | SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); |
1649 | 1649 | ||
1650 | ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr)); | 1650 | ddp = skb_put(skb, sizeof(struct ddpehdr)); |
1651 | ddp->deh_len_hops = htons(len + sizeof(*ddp)); | 1651 | ddp->deh_len_hops = htons(len + sizeof(*ddp)); |
1652 | ddp->deh_dnet = usat->sat_addr.s_net; | 1652 | ddp->deh_dnet = usat->sat_addr.s_net; |
1653 | ddp->deh_snet = at->src_net; | 1653 | ddp->deh_snet = at->src_net; |
diff --git a/net/atm/clip.c b/net/atm/clip.c index ec527b62f79d..a7e4018370b4 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -60,7 +60,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) | |||
60 | skb = alloc_skb(sizeof(struct atmarp_ctrl), GFP_ATOMIC); | 60 | skb = alloc_skb(sizeof(struct atmarp_ctrl), GFP_ATOMIC); |
61 | if (!skb) | 61 | if (!skb) |
62 | return -ENOMEM; | 62 | return -ENOMEM; |
63 | ctrl = (struct atmarp_ctrl *)skb_put(skb, sizeof(struct atmarp_ctrl)); | 63 | ctrl = skb_put(skb, sizeof(struct atmarp_ctrl)); |
64 | ctrl->type = type; | 64 | ctrl->type = type; |
65 | ctrl->itf_num = itf; | 65 | ctrl->itf_num = itf; |
66 | ctrl->ip = ip; | 66 | ctrl->ip = ip; |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 6308c9f0fd96..8ead292886d1 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -207,7 +207,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, | |||
207 | 207 | ||
208 | skb->priority = TC_PRIO_CONTROL; | 208 | skb->priority = TC_PRIO_CONTROL; |
209 | skb_reserve(skb, ETH_HLEN); | 209 | skb_reserve(skb, ETH_HLEN); |
210 | icmp_header = (struct batadv_icmp_header *)skb_put(skb, packet_len); | 210 | icmp_header = skb_put(skb, packet_len); |
211 | 211 | ||
212 | if (copy_from_user(icmp_header, buff, packet_len)) { | 212 | if (copy_from_user(icmp_header, buff, packet_len)) { |
213 | len = -EFAULT; | 213 | len = -EFAULT; |
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index e3e2585d0977..bfe8effe9238 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c | |||
@@ -595,7 +595,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, | |||
595 | return BATADV_TP_REASON_MEMORY_ERROR; | 595 | return BATADV_TP_REASON_MEMORY_ERROR; |
596 | 596 | ||
597 | skb_reserve(skb, ETH_HLEN); | 597 | skb_reserve(skb, ETH_HLEN); |
598 | icmp = (struct batadv_icmp_tp_packet *)skb_put(skb, sizeof(*icmp)); | 598 | icmp = skb_put(skb, sizeof(*icmp)); |
599 | 599 | ||
600 | /* fill the icmp header */ | 600 | /* fill the icmp header */ |
601 | ether_addr_copy(icmp->dst, orig_node->orig); | 601 | ether_addr_copy(icmp->dst, orig_node->orig); |
@@ -612,7 +612,7 @@ static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, | |||
612 | icmp->timestamp = htonl(timestamp); | 612 | icmp->timestamp = htonl(timestamp); |
613 | 613 | ||
614 | data_len = len - sizeof(*icmp); | 614 | data_len = len - sizeof(*icmp); |
615 | data = (u8 *)skb_put(skb, data_len); | 615 | data = skb_put(skb, data_len); |
616 | batadv_tp_fill_prerandom(tp_vars, data, data_len); | 616 | batadv_tp_fill_prerandom(tp_vars, data, data_len); |
617 | 617 | ||
618 | r = batadv_send_skb_to_orig(skb, orig_node, NULL); | 618 | r = batadv_send_skb_to_orig(skb, orig_node, NULL); |
@@ -1190,7 +1190,7 @@ static int batadv_tp_send_ack(struct batadv_priv *bat_priv, const u8 *dst, | |||
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | skb_reserve(skb, ETH_HLEN); | 1192 | skb_reserve(skb, ETH_HLEN); |
1193 | icmp = (struct batadv_icmp_tp_packet *)skb_put(skb, sizeof(*icmp)); | 1193 | icmp = skb_put(skb, sizeof(*icmp)); |
1194 | icmp->packet_type = BATADV_ICMP; | 1194 | icmp->packet_type = BATADV_ICMP; |
1195 | icmp->version = BATADV_COMPAT_VERSION; | 1195 | icmp->version = BATADV_COMPAT_VERSION; |
1196 | icmp->ttl = BATADV_TTL; | 1196 | icmp->ttl = BATADV_TTL; |
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 4e4105a932bd..b73ac149de34 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -299,7 +299,7 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, | |||
299 | if (!skb) | 299 | if (!skb) |
300 | return NULL; | 300 | return NULL; |
301 | 301 | ||
302 | hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE); | 302 | hdr = skb_put(skb, HCI_COMMAND_HDR_SIZE); |
303 | hdr->opcode = cpu_to_le16(opcode); | 303 | hdr->opcode = cpu_to_le16(opcode); |
304 | hdr->plen = plen; | 304 | hdr->plen = plen; |
305 | 305 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 083e87f26a0f..1301a8786d8d 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -410,7 +410,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) | |||
410 | if (!skb) | 410 | if (!skb) |
411 | return NULL; | 411 | return NULL; |
412 | 412 | ||
413 | ni = (void *)skb_put(skb, HCI_MON_NEW_INDEX_SIZE); | 413 | ni = skb_put(skb, HCI_MON_NEW_INDEX_SIZE); |
414 | ni->type = hdev->dev_type; | 414 | ni->type = hdev->dev_type; |
415 | ni->bus = hdev->bus; | 415 | ni->bus = hdev->bus; |
416 | bacpy(&ni->bdaddr, &hdev->bdaddr); | 416 | bacpy(&ni->bdaddr, &hdev->bdaddr); |
@@ -438,7 +438,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) | |||
438 | if (!skb) | 438 | if (!skb) |
439 | return NULL; | 439 | return NULL; |
440 | 440 | ||
441 | ii = (void *)skb_put(skb, HCI_MON_INDEX_INFO_SIZE); | 441 | ii = skb_put(skb, HCI_MON_INDEX_INFO_SIZE); |
442 | bacpy(&ii->bdaddr, &hdev->bdaddr); | 442 | bacpy(&ii->bdaddr, &hdev->bdaddr); |
443 | ii->manufacturer = cpu_to_le16(hdev->manufacturer); | 443 | ii->manufacturer = cpu_to_le16(hdev->manufacturer); |
444 | 444 | ||
@@ -517,7 +517,7 @@ static struct sk_buff *create_monitor_ctrl_open(struct sock *sk) | |||
517 | put_unaligned_le16(format, skb_put(skb, 2)); | 517 | put_unaligned_le16(format, skb_put(skb, 2)); |
518 | skb_put_data(skb, ver, sizeof(ver)); | 518 | skb_put_data(skb, ver, sizeof(ver)); |
519 | put_unaligned_le32(flags, skb_put(skb, 4)); | 519 | put_unaligned_le32(flags, skb_put(skb, 4)); |
520 | *skb_put(skb, 1) = TASK_COMM_LEN; | 520 | *(u8 *)skb_put(skb, 1) = TASK_COMM_LEN; |
521 | skb_put_data(skb, hci_pi(sk)->comm, TASK_COMM_LEN); | 521 | skb_put_data(skb, hci_pi(sk)->comm, TASK_COMM_LEN); |
522 | 522 | ||
523 | __net_timestamp(skb); | 523 | __net_timestamp(skb); |
@@ -616,7 +616,7 @@ send_monitor_note(struct sock *sk, const char *fmt, ...) | |||
616 | 616 | ||
617 | va_start(args, fmt); | 617 | va_start(args, fmt); |
618 | vsprintf(skb_put(skb, len), fmt, args); | 618 | vsprintf(skb_put(skb, len), fmt, args); |
619 | *skb_put(skb, 1) = 0; | 619 | *(u8 *)skb_put(skb, 1) = 0; |
620 | va_end(args); | 620 | va_end(args); |
621 | 621 | ||
622 | __net_timestamp(skb); | 622 | __net_timestamp(skb); |
@@ -703,11 +703,11 @@ static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data) | |||
703 | if (!skb) | 703 | if (!skb) |
704 | return; | 704 | return; |
705 | 705 | ||
706 | hdr = (void *)skb_put(skb, HCI_EVENT_HDR_SIZE); | 706 | hdr = skb_put(skb, HCI_EVENT_HDR_SIZE); |
707 | hdr->evt = HCI_EV_STACK_INTERNAL; | 707 | hdr->evt = HCI_EV_STACK_INTERNAL; |
708 | hdr->plen = sizeof(*ev) + dlen; | 708 | hdr->plen = sizeof(*ev) + dlen; |
709 | 709 | ||
710 | ev = (void *)skb_put(skb, sizeof(*ev) + dlen); | 710 | ev = skb_put(skb, sizeof(*ev) + dlen); |
711 | ev->type = type; | 711 | ev->type = type; |
712 | memcpy(ev->data, data, dlen); | 712 | memcpy(ev->data, data, dlen); |
713 | 713 | ||
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 9e83713262e8..c0d0832a023d 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -112,7 +112,7 @@ static int hidp_send_message(struct hidp_session *session, struct socket *sock, | |||
112 | return -ENOMEM; | 112 | return -ENOMEM; |
113 | } | 113 | } |
114 | 114 | ||
115 | *skb_put(skb, 1) = hdr; | 115 | *(u8 *)skb_put(skb, 1) = hdr; |
116 | if (data && size > 0) | 116 | if (data && size > 0) |
117 | skb_put_data(skb, data, size); | 117 | skb_put_data(skb, data, size); |
118 | 118 | ||
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index fe6a5529bdf5..303c779bfe38 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1048,7 +1048,7 @@ static struct sk_buff *l2cap_create_sframe_pdu(struct l2cap_chan *chan, | |||
1048 | if (!skb) | 1048 | if (!skb) |
1049 | return ERR_PTR(-ENOMEM); | 1049 | return ERR_PTR(-ENOMEM); |
1050 | 1050 | ||
1051 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 1051 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
1052 | lh->len = cpu_to_le16(hlen - L2CAP_HDR_SIZE); | 1052 | lh->len = cpu_to_le16(hlen - L2CAP_HDR_SIZE); |
1053 | lh->cid = cpu_to_le16(chan->dcid); | 1053 | lh->cid = cpu_to_le16(chan->dcid); |
1054 | 1054 | ||
@@ -2182,7 +2182,7 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, | |||
2182 | return skb; | 2182 | return skb; |
2183 | 2183 | ||
2184 | /* Create L2CAP header */ | 2184 | /* Create L2CAP header */ |
2185 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 2185 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
2186 | lh->cid = cpu_to_le16(chan->dcid); | 2186 | lh->cid = cpu_to_le16(chan->dcid); |
2187 | lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE); | 2187 | lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE); |
2188 | put_unaligned(chan->psm, (__le16 *) skb_put(skb, L2CAP_PSMLEN_SIZE)); | 2188 | put_unaligned(chan->psm, (__le16 *) skb_put(skb, L2CAP_PSMLEN_SIZE)); |
@@ -2213,7 +2213,7 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, | |||
2213 | return skb; | 2213 | return skb; |
2214 | 2214 | ||
2215 | /* Create L2CAP header */ | 2215 | /* Create L2CAP header */ |
2216 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 2216 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
2217 | lh->cid = cpu_to_le16(chan->dcid); | 2217 | lh->cid = cpu_to_le16(chan->dcid); |
2218 | lh->len = cpu_to_le16(len); | 2218 | lh->len = cpu_to_le16(len); |
2219 | 2219 | ||
@@ -2255,7 +2255,7 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, | |||
2255 | return skb; | 2255 | return skb; |
2256 | 2256 | ||
2257 | /* Create L2CAP header */ | 2257 | /* Create L2CAP header */ |
2258 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 2258 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
2259 | lh->cid = cpu_to_le16(chan->dcid); | 2259 | lh->cid = cpu_to_le16(chan->dcid); |
2260 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); | 2260 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); |
2261 | 2261 | ||
@@ -2373,7 +2373,7 @@ static struct sk_buff *l2cap_create_le_flowctl_pdu(struct l2cap_chan *chan, | |||
2373 | return skb; | 2373 | return skb; |
2374 | 2374 | ||
2375 | /* Create L2CAP header */ | 2375 | /* Create L2CAP header */ |
2376 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 2376 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
2377 | lh->cid = cpu_to_le16(chan->dcid); | 2377 | lh->cid = cpu_to_le16(chan->dcid); |
2378 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); | 2378 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); |
2379 | 2379 | ||
@@ -2908,7 +2908,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, | |||
2908 | if (!skb) | 2908 | if (!skb) |
2909 | return NULL; | 2909 | return NULL; |
2910 | 2910 | ||
2911 | lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); | 2911 | lh = skb_put(skb, L2CAP_HDR_SIZE); |
2912 | lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); | 2912 | lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); |
2913 | 2913 | ||
2914 | if (conn->hcon->type == LE_LINK) | 2914 | if (conn->hcon->type == LE_LINK) |
@@ -2916,7 +2916,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code, | |||
2916 | else | 2916 | else |
2917 | lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING); | 2917 | lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING); |
2918 | 2918 | ||
2919 | cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); | 2919 | cmd = skb_put(skb, L2CAP_CMD_HDR_SIZE); |
2920 | cmd->code = code; | 2920 | cmd->code = code; |
2921 | cmd->ident = ident; | 2921 | cmd->ident = ident; |
2922 | cmd->len = cpu_to_le16(dlen); | 2922 | cmd->len = cpu_to_le16(dlen); |
diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c index 11d0ca64402b..d057113e0d4b 100644 --- a/net/bluetooth/mgmt_util.c +++ b/net/bluetooth/mgmt_util.c | |||
@@ -66,7 +66,7 @@ int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel, | |||
66 | if (!skb) | 66 | if (!skb) |
67 | return -ENOMEM; | 67 | return -ENOMEM; |
68 | 68 | ||
69 | hdr = (void *) skb_put(skb, sizeof(*hdr)); | 69 | hdr = skb_put(skb, sizeof(*hdr)); |
70 | hdr->opcode = cpu_to_le16(event); | 70 | hdr->opcode = cpu_to_le16(event); |
71 | if (hdev) | 71 | if (hdev) |
72 | hdr->index = cpu_to_le16(hdev->id); | 72 | hdr->index = cpu_to_le16(hdev->id); |
@@ -103,13 +103,13 @@ int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status) | |||
103 | if (!skb) | 103 | if (!skb) |
104 | return -ENOMEM; | 104 | return -ENOMEM; |
105 | 105 | ||
106 | hdr = (void *) skb_put(skb, sizeof(*hdr)); | 106 | hdr = skb_put(skb, sizeof(*hdr)); |
107 | 107 | ||
108 | hdr->opcode = cpu_to_le16(MGMT_EV_CMD_STATUS); | 108 | hdr->opcode = cpu_to_le16(MGMT_EV_CMD_STATUS); |
109 | hdr->index = cpu_to_le16(index); | 109 | hdr->index = cpu_to_le16(index); |
110 | hdr->len = cpu_to_le16(sizeof(*ev)); | 110 | hdr->len = cpu_to_le16(sizeof(*ev)); |
111 | 111 | ||
112 | ev = (void *) skb_put(skb, sizeof(*ev)); | 112 | ev = skb_put(skb, sizeof(*ev)); |
113 | ev->status = status; | 113 | ev->status = status; |
114 | ev->opcode = cpu_to_le16(cmd); | 114 | ev->opcode = cpu_to_le16(cmd); |
115 | 115 | ||
@@ -147,13 +147,13 @@ int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status, | |||
147 | if (!skb) | 147 | if (!skb) |
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | 149 | ||
150 | hdr = (void *) skb_put(skb, sizeof(*hdr)); | 150 | hdr = skb_put(skb, sizeof(*hdr)); |
151 | 151 | ||
152 | hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE); | 152 | hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE); |
153 | hdr->index = cpu_to_le16(index); | 153 | hdr->index = cpu_to_le16(index); |
154 | hdr->len = cpu_to_le16(sizeof(*ev) + rp_len); | 154 | hdr->len = cpu_to_le16(sizeof(*ev) + rp_len); |
155 | 155 | ||
156 | ev = (void *) skb_put(skb, sizeof(*ev) + rp_len); | 156 | ev = skb_put(skb, sizeof(*ev) + rp_len); |
157 | ev->opcode = cpu_to_le16(cmd); | 157 | ev->opcode = cpu_to_le16(cmd); |
158 | ev->status = status; | 158 | ev->status = status; |
159 | 159 | ||
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 8ebca9033d60..1a9b906c5a35 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -863,7 +863,7 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d) | |||
863 | if (!skb) | 863 | if (!skb) |
864 | return -ENOMEM; | 864 | return -ENOMEM; |
865 | 865 | ||
866 | cmd = (void *) __skb_put(skb, sizeof(*cmd)); | 866 | cmd = __skb_put(skb, sizeof(*cmd)); |
867 | cmd->addr = d->addr; | 867 | cmd->addr = d->addr; |
868 | cmd->ctrl = __ctrl(RFCOMM_DISC, 1); | 868 | cmd->ctrl = __ctrl(RFCOMM_DISC, 1); |
869 | cmd->len = __len8(0); | 869 | cmd->len = __len8(0); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8860ad985d68..b8bcf9021329 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2714,7 +2714,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, | |||
2714 | struct timeval timestamp; | 2714 | struct timeval timestamp; |
2715 | struct pktgen_hdr *pgh; | 2715 | struct pktgen_hdr *pgh; |
2716 | 2716 | ||
2717 | pgh = (struct pktgen_hdr *)skb_put(skb, sizeof(*pgh)); | 2717 | pgh = skb_put(skb, sizeof(*pgh)); |
2718 | datalen -= sizeof(*pgh); | 2718 | datalen -= sizeof(*pgh); |
2719 | 2719 | ||
2720 | if (pkt_dev->nfrags <= 0) { | 2720 | if (pkt_dev->nfrags <= 0) { |
@@ -2845,33 +2845,34 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2845 | 2845 | ||
2846 | /* Reserve for ethernet and IP header */ | 2846 | /* Reserve for ethernet and IP header */ |
2847 | eth = (__u8 *) skb_push(skb, 14); | 2847 | eth = (__u8 *) skb_push(skb, 14); |
2848 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); | 2848 | mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); |
2849 | if (pkt_dev->nr_labels) | 2849 | if (pkt_dev->nr_labels) |
2850 | mpls_push(mpls, pkt_dev); | 2850 | mpls_push(mpls, pkt_dev); |
2851 | 2851 | ||
2852 | if (pkt_dev->vlan_id != 0xffff) { | 2852 | if (pkt_dev->vlan_id != 0xffff) { |
2853 | if (pkt_dev->svlan_id != 0xffff) { | 2853 | if (pkt_dev->svlan_id != 0xffff) { |
2854 | svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | 2854 | svlan_tci = skb_put(skb, sizeof(__be16)); |
2855 | *svlan_tci = build_tci(pkt_dev->svlan_id, | 2855 | *svlan_tci = build_tci(pkt_dev->svlan_id, |
2856 | pkt_dev->svlan_cfi, | 2856 | pkt_dev->svlan_cfi, |
2857 | pkt_dev->svlan_p); | 2857 | pkt_dev->svlan_p); |
2858 | svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | 2858 | svlan_encapsulated_proto = skb_put(skb, |
2859 | sizeof(__be16)); | ||
2859 | *svlan_encapsulated_proto = htons(ETH_P_8021Q); | 2860 | *svlan_encapsulated_proto = htons(ETH_P_8021Q); |
2860 | } | 2861 | } |
2861 | vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | 2862 | vlan_tci = skb_put(skb, sizeof(__be16)); |
2862 | *vlan_tci = build_tci(pkt_dev->vlan_id, | 2863 | *vlan_tci = build_tci(pkt_dev->vlan_id, |
2863 | pkt_dev->vlan_cfi, | 2864 | pkt_dev->vlan_cfi, |
2864 | pkt_dev->vlan_p); | 2865 | pkt_dev->vlan_p); |
2865 | vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | 2866 | vlan_encapsulated_proto = skb_put(skb, sizeof(__be16)); |
2866 | *vlan_encapsulated_proto = htons(ETH_P_IP); | 2867 | *vlan_encapsulated_proto = htons(ETH_P_IP); |
2867 | } | 2868 | } |
2868 | 2869 | ||
2869 | skb_reset_mac_header(skb); | 2870 | skb_reset_mac_header(skb); |
2870 | skb_set_network_header(skb, skb->len); | 2871 | skb_set_network_header(skb, skb->len); |
2871 | iph = (struct iphdr *) skb_put(skb, sizeof(struct iphdr)); | 2872 | iph = skb_put(skb, sizeof(struct iphdr)); |
2872 | 2873 | ||
2873 | skb_set_transport_header(skb, skb->len); | 2874 | skb_set_transport_header(skb, skb->len); |
2874 | udph = (struct udphdr *) skb_put(skb, sizeof(struct udphdr)); | 2875 | udph = skb_put(skb, sizeof(struct udphdr)); |
2875 | skb_set_queue_mapping(skb, queue_map); | 2876 | skb_set_queue_mapping(skb, queue_map); |
2876 | skb->priority = pkt_dev->skb_priority; | 2877 | skb->priority = pkt_dev->skb_priority; |
2877 | 2878 | ||
@@ -2972,33 +2973,34 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2972 | 2973 | ||
2973 | /* Reserve for ethernet and IP header */ | 2974 | /* Reserve for ethernet and IP header */ |
2974 | eth = (__u8 *) skb_push(skb, 14); | 2975 | eth = (__u8 *) skb_push(skb, 14); |
2975 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); | 2976 | mpls = skb_put(skb, pkt_dev->nr_labels * sizeof(__u32)); |
2976 | if (pkt_dev->nr_labels) | 2977 | if (pkt_dev->nr_labels) |
2977 | mpls_push(mpls, pkt_dev); | 2978 | mpls_push(mpls, pkt_dev); |
2978 | 2979 | ||
2979 | if (pkt_dev->vlan_id != 0xffff) { | 2980 | if (pkt_dev->vlan_id != 0xffff) { |
2980 | if (pkt_dev->svlan_id != 0xffff) { | 2981 | if (pkt_dev->svlan_id != 0xffff) { |
2981 | svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | 2982 | svlan_tci = skb_put(skb, sizeof(__be16)); |
2982 | *svlan_tci = build_tci(pkt_dev->svlan_id, | 2983 | *svlan_tci = build_tci(pkt_dev->svlan_id, |
2983 | pkt_dev->svlan_cfi, | 2984 | pkt_dev->svlan_cfi, |
2984 | pkt_dev->svlan_p); | 2985 | pkt_dev->svlan_p); |
2985 | svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | 2986 | svlan_encapsulated_proto = skb_put(skb, |
2987 | sizeof(__be16)); | ||
2986 | *svlan_encapsulated_proto = htons(ETH_P_8021Q); | 2988 | *svlan_encapsulated_proto = htons(ETH_P_8021Q); |
2987 | } | 2989 | } |
2988 | vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | 2990 | vlan_tci = skb_put(skb, sizeof(__be16)); |
2989 | *vlan_tci = build_tci(pkt_dev->vlan_id, | 2991 | *vlan_tci = build_tci(pkt_dev->vlan_id, |
2990 | pkt_dev->vlan_cfi, | 2992 | pkt_dev->vlan_cfi, |
2991 | pkt_dev->vlan_p); | 2993 | pkt_dev->vlan_p); |
2992 | vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | 2994 | vlan_encapsulated_proto = skb_put(skb, sizeof(__be16)); |
2993 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); | 2995 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); |
2994 | } | 2996 | } |
2995 | 2997 | ||
2996 | skb_reset_mac_header(skb); | 2998 | skb_reset_mac_header(skb); |
2997 | skb_set_network_header(skb, skb->len); | 2999 | skb_set_network_header(skb, skb->len); |
2998 | iph = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr)); | 3000 | iph = skb_put(skb, sizeof(struct ipv6hdr)); |
2999 | 3001 | ||
3000 | skb_set_transport_header(skb, skb->len); | 3002 | skb_set_transport_header(skb, skb->len); |
3001 | udph = (struct udphdr *) skb_put(skb, sizeof(struct udphdr)); | 3003 | udph = skb_put(skb, sizeof(struct udphdr)); |
3002 | skb_set_queue_mapping(skb, queue_map); | 3004 | skb_set_queue_mapping(skb, queue_map); |
3003 | skb->priority = pkt_dev->skb_priority; | 3005 | skb->priority = pkt_dev->skb_priority; |
3004 | 3006 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c4d2c1f824bb..0baa7f2dd8ef 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1421,7 +1421,7 @@ EXPORT_SYMBOL(skb_pad); | |||
1421 | * returned. | 1421 | * returned. |
1422 | */ | 1422 | */ |
1423 | 1423 | ||
1424 | unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) | 1424 | void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) |
1425 | { | 1425 | { |
1426 | if (tail != skb) { | 1426 | if (tail != skb) { |
1427 | skb->data_len += len; | 1427 | skb->data_len += len; |
@@ -1440,9 +1440,9 @@ EXPORT_SYMBOL_GPL(pskb_put); | |||
1440 | * exceed the total buffer size the kernel will panic. A pointer to the | 1440 | * exceed the total buffer size the kernel will panic. A pointer to the |
1441 | * first byte of the extra data is returned. | 1441 | * first byte of the extra data is returned. |
1442 | */ | 1442 | */ |
1443 | unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | 1443 | void *skb_put(struct sk_buff *skb, unsigned int len) |
1444 | { | 1444 | { |
1445 | unsigned char *tmp = skb_tail_pointer(skb); | 1445 | void *tmp = skb_tail_pointer(skb); |
1446 | SKB_LINEAR_ASSERT(skb); | 1446 | SKB_LINEAR_ASSERT(skb); |
1447 | skb->tail += len; | 1447 | skb->tail += len; |
1448 | skb->len += len; | 1448 | skb->len += len; |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 9017a9a73ab5..1d84f6dae315 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -846,7 +846,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) | |||
846 | 846 | ||
847 | skb->dev = dev; | 847 | skb->dev = dev; |
848 | 848 | ||
849 | msg = (struct endnode_hello_message *)skb_put(skb,sizeof(*msg)); | 849 | msg = skb_put(skb, sizeof(*msg)); |
850 | 850 | ||
851 | msg->msgflg = 0x0D; | 851 | msg->msgflg = 0x0D; |
852 | memcpy(msg->tiver, dn_eco_version, 3); | 852 | memcpy(msg->tiver, dn_eco_version, 3); |
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b8a558715395..7e054b2f270a 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c | |||
@@ -484,7 +484,7 @@ void dn_send_conn_ack (struct sock *sk) | |||
484 | if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) | 484 | if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) |
485 | return; | 485 | return; |
486 | 486 | ||
487 | msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); | 487 | msg = skb_put(skb, 3); |
488 | msg->msgflg = 0x24; | 488 | msg->msgflg = 0x24; |
489 | msg->dstaddr = scp->addrrem; | 489 | msg->dstaddr = scp->addrrem; |
490 | 490 | ||
@@ -522,7 +522,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
522 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) | 522 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) |
523 | return; | 523 | return; |
524 | 524 | ||
525 | msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); | 525 | msg = skb_put(skb, sizeof(*msg)); |
526 | msg->msgflg = 0x28; | 526 | msg->msgflg = 0x28; |
527 | msg->dstaddr = scp->addrrem; | 527 | msg->dstaddr = scp->addrrem; |
528 | msg->srcaddr = scp->addrloc; | 528 | msg->srcaddr = scp->addrloc; |
@@ -530,7 +530,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
530 | msg->info = scp->info_loc; | 530 | msg->info = scp->info_loc; |
531 | msg->segsize = cpu_to_le16(scp->segsize_loc); | 531 | msg->segsize = cpu_to_le16(scp->segsize_loc); |
532 | 532 | ||
533 | *skb_put(skb,1) = len; | 533 | *(u8 *)skb_put(skb, 1) = len; |
534 | 534 | ||
535 | if (len > 0) | 535 | if (len > 0) |
536 | skb_put_data(skb, scp->conndata_out.opt_data, len); | 536 | skb_put_data(skb, scp->conndata_out.opt_data, len); |
@@ -662,7 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
662 | return; | 662 | return; |
663 | 663 | ||
664 | cb = DN_SKB_CB(skb); | 664 | cb = DN_SKB_CB(skb); |
665 | msg = (struct nsp_conn_init_msg *)skb_put(skb,sizeof(*msg)); | 665 | msg = skb_put(skb, sizeof(*msg)); |
666 | 666 | ||
667 | msg->msgflg = msgflg; | 667 | msg->msgflg = msgflg; |
668 | msg->dstaddr = 0x0000; /* Remote Node will assign it*/ | 668 | msg->dstaddr = 0x0000; /* Remote Node will assign it*/ |
@@ -686,25 +686,25 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
686 | if (scp->peer.sdn_flags & SDF_UICPROXY) | 686 | if (scp->peer.sdn_flags & SDF_UICPROXY) |
687 | menuver |= DN_MENUVER_UIC; | 687 | menuver |= DN_MENUVER_UIC; |
688 | 688 | ||
689 | *skb_put(skb, 1) = menuver; /* Menu Version */ | 689 | *(u8 *)skb_put(skb, 1) = menuver; /* Menu Version */ |
690 | 690 | ||
691 | aux = scp->accessdata.acc_userl; | 691 | aux = scp->accessdata.acc_userl; |
692 | *skb_put(skb, 1) = aux; | 692 | *(u8 *)skb_put(skb, 1) = aux; |
693 | if (aux > 0) | 693 | if (aux > 0) |
694 | skb_put_data(skb, scp->accessdata.acc_user, aux); | 694 | skb_put_data(skb, scp->accessdata.acc_user, aux); |
695 | 695 | ||
696 | aux = scp->accessdata.acc_passl; | 696 | aux = scp->accessdata.acc_passl; |
697 | *skb_put(skb, 1) = aux; | 697 | *(u8 *)skb_put(skb, 1) = aux; |
698 | if (aux > 0) | 698 | if (aux > 0) |
699 | skb_put_data(skb, scp->accessdata.acc_pass, aux); | 699 | skb_put_data(skb, scp->accessdata.acc_pass, aux); |
700 | 700 | ||
701 | aux = scp->accessdata.acc_accl; | 701 | aux = scp->accessdata.acc_accl; |
702 | *skb_put(skb, 1) = aux; | 702 | *(u8 *)skb_put(skb, 1) = aux; |
703 | if (aux > 0) | 703 | if (aux > 0) |
704 | skb_put_data(skb, scp->accessdata.acc_acc, aux); | 704 | skb_put_data(skb, scp->accessdata.acc_acc, aux); |
705 | 705 | ||
706 | aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); | 706 | aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); |
707 | *skb_put(skb, 1) = aux; | 707 | *(u8 *)skb_put(skb, 1) = aux; |
708 | if (aux > 0) | 708 | if (aux > 0) |
709 | skb_put_data(skb, scp->conndata_out.opt_data, aux); | 709 | skb_put_data(skb, scp->conndata_out.opt_data, aux); |
710 | 710 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index a651c53260ec..8b52179ddc6e 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -539,7 +539,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, | |||
539 | 539 | ||
540 | skb_reserve(skb, hlen); | 540 | skb_reserve(skb, hlen); |
541 | skb_reset_network_header(skb); | 541 | skb_reset_network_header(skb); |
542 | arp = (struct arphdr *) skb_put(skb, arp_hdr_len(dev)); | 542 | arp = skb_put(skb, arp_hdr_len(dev)); |
543 | skb->dev = dev; | 543 | skb->dev = dev; |
544 | skb->protocol = htons(ETH_P_ARP); | 544 | skb->protocol = htons(ETH_P_ARP); |
545 | if (!src_hw) | 545 | if (!src_hw) |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 8f6b5bbcbf69..2202edf31884 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -414,7 +414,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
414 | skb = igmpv3_newpack(dev, dev->mtu); | 414 | skb = igmpv3_newpack(dev, dev->mtu); |
415 | if (!skb) | 415 | if (!skb) |
416 | return NULL; | 416 | return NULL; |
417 | pgr = (struct igmpv3_grec *)skb_put(skb, sizeof(struct igmpv3_grec)); | 417 | pgr = skb_put(skb, sizeof(struct igmpv3_grec)); |
418 | pgr->grec_type = type; | 418 | pgr->grec_type = type; |
419 | pgr->grec_auxwords = 0; | 419 | pgr->grec_auxwords = 0; |
420 | pgr->grec_nsrcs = 0; | 420 | pgr->grec_nsrcs = 0; |
@@ -508,7 +508,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
508 | } | 508 | } |
509 | if (!skb) | 509 | if (!skb) |
510 | return NULL; | 510 | return NULL; |
511 | psrc = (__be32 *)skb_put(skb, sizeof(__be32)); | 511 | psrc = skb_put(skb, sizeof(__be32)); |
512 | *psrc = psf->sf_inaddr; | 512 | *psrc = psf->sf_inaddr; |
513 | scount++; stotal++; | 513 | scount++; stotal++; |
514 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || | 514 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || |
@@ -742,7 +742,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
742 | ((u8 *)&iph[1])[2] = 0; | 742 | ((u8 *)&iph[1])[2] = 0; |
743 | ((u8 *)&iph[1])[3] = 0; | 743 | ((u8 *)&iph[1])[3] = 0; |
744 | 744 | ||
745 | ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); | 745 | ih = skb_put(skb, sizeof(struct igmphdr)); |
746 | ih->type = type; | 746 | ih->type = type; |
747 | ih->code = 0; | 747 | ih->code = 0; |
748 | ih->csum = 0; | 748 | ih->csum = 0; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index a1199895b8a6..abbd7c992960 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1044,7 +1044,7 @@ static int ipmr_cache_report(struct mr_table *mrt, | |||
1044 | msg->im_vif = vifi; | 1044 | msg->im_vif = vifi; |
1045 | skb_dst_set(skb, dst_clone(skb_dst(pkt))); | 1045 | skb_dst_set(skb, dst_clone(skb_dst(pkt))); |
1046 | /* Add our header */ | 1046 | /* Add our header */ |
1047 | igmp = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); | 1047 | igmp = skb_put(skb, sizeof(struct igmphdr)); |
1048 | igmp->type = assert; | 1048 | igmp->type = assert; |
1049 | msg->im_msgtype = assert; | 1049 | msg->im_msgtype = assert; |
1050 | igmp->code = 0; | 1050 | igmp->code = 0; |
diff --git a/net/ipv4/netfilter/ipt_SYNPROXY.c b/net/ipv4/netfilter/ipt_SYNPROXY.c index af2b69b6895f..f1528f7175a8 100644 --- a/net/ipv4/netfilter/ipt_SYNPROXY.c +++ b/net/ipv4/netfilter/ipt_SYNPROXY.c | |||
@@ -24,7 +24,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr, | |||
24 | struct iphdr *iph; | 24 | struct iphdr *iph; |
25 | 25 | ||
26 | skb_reset_network_header(skb); | 26 | skb_reset_network_header(skb); |
27 | iph = (struct iphdr *)skb_put(skb, sizeof(*iph)); | 27 | iph = skb_put(skb, sizeof(*iph)); |
28 | iph->version = 4; | 28 | iph->version = 4; |
29 | iph->ihl = sizeof(*iph) / 4; | 29 | iph->ihl = sizeof(*iph) / 4; |
30 | iph->tos = 0; | 30 | iph->tos = 0; |
@@ -91,7 +91,7 @@ synproxy_send_client_synack(struct net *net, | |||
91 | niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); | 91 | niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); |
92 | 92 | ||
93 | skb_reset_transport_header(nskb); | 93 | skb_reset_transport_header(nskb); |
94 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 94 | nth = skb_put(nskb, tcp_hdr_size); |
95 | nth->source = th->dest; | 95 | nth->source = th->dest; |
96 | nth->dest = th->source; | 96 | nth->dest = th->source; |
97 | nth->seq = htonl(__cookie_v4_init_sequence(iph, th, &mss)); | 97 | nth->seq = htonl(__cookie_v4_init_sequence(iph, th, &mss)); |
@@ -133,7 +133,7 @@ synproxy_send_server_syn(struct net *net, | |||
133 | niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); | 133 | niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); |
134 | 134 | ||
135 | skb_reset_transport_header(nskb); | 135 | skb_reset_transport_header(nskb); |
136 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 136 | nth = skb_put(nskb, tcp_hdr_size); |
137 | nth->source = th->source; | 137 | nth->source = th->source; |
138 | nth->dest = th->dest; | 138 | nth->dest = th->dest; |
139 | nth->seq = htonl(recv_seq - 1); | 139 | nth->seq = htonl(recv_seq - 1); |
@@ -178,7 +178,7 @@ synproxy_send_server_ack(struct net *net, | |||
178 | niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); | 178 | niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr); |
179 | 179 | ||
180 | skb_reset_transport_header(nskb); | 180 | skb_reset_transport_header(nskb); |
181 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 181 | nth = skb_put(nskb, tcp_hdr_size); |
182 | nth->source = th->dest; | 182 | nth->source = th->dest; |
183 | nth->dest = th->source; | 183 | nth->dest = th->source; |
184 | nth->seq = htonl(ntohl(th->ack_seq)); | 184 | nth->seq = htonl(ntohl(th->ack_seq)); |
@@ -216,7 +216,7 @@ synproxy_send_client_ack(struct net *net, | |||
216 | niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); | 216 | niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr); |
217 | 217 | ||
218 | skb_reset_transport_header(nskb); | 218 | skb_reset_transport_header(nskb); |
219 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 219 | nth = skb_put(nskb, tcp_hdr_size); |
220 | nth->source = th->source; | 220 | nth->source = th->source; |
221 | nth->dest = th->dest; | 221 | nth->dest = th->dest; |
222 | nth->seq = htonl(ntohl(th->seq) + 1); | 222 | nth->seq = htonl(ntohl(th->seq) + 1); |
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index 52b7dcc5aaf3..eeacbdaf7cdf 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c | |||
@@ -51,7 +51,7 @@ struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, | |||
51 | struct iphdr *niph, *oiph = ip_hdr(oldskb); | 51 | struct iphdr *niph, *oiph = ip_hdr(oldskb); |
52 | 52 | ||
53 | skb_reset_network_header(nskb); | 53 | skb_reset_network_header(nskb); |
54 | niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); | 54 | niph = skb_put(nskb, sizeof(struct iphdr)); |
55 | niph->version = 4; | 55 | niph->version = 4; |
56 | niph->ihl = sizeof(struct iphdr) / 4; | 56 | niph->ihl = sizeof(struct iphdr) / 4; |
57 | niph->tos = 0; | 57 | niph->tos = 0; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index b64046ccae69..e2221135858b 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1692,7 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1692 | skb = mld_newpack(pmc->idev, dev->mtu); | 1692 | skb = mld_newpack(pmc->idev, dev->mtu); |
1693 | if (!skb) | 1693 | if (!skb) |
1694 | return NULL; | 1694 | return NULL; |
1695 | pgr = (struct mld2_grec *)skb_put(skb, sizeof(struct mld2_grec)); | 1695 | pgr = skb_put(skb, sizeof(struct mld2_grec)); |
1696 | pgr->grec_type = type; | 1696 | pgr->grec_type = type; |
1697 | pgr->grec_auxwords = 0; | 1697 | pgr->grec_auxwords = 0; |
1698 | pgr->grec_nsrcs = 0; | 1698 | pgr->grec_nsrcs = 0; |
@@ -1784,7 +1784,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1784 | } | 1784 | } |
1785 | if (!skb) | 1785 | if (!skb) |
1786 | return NULL; | 1786 | return NULL; |
1787 | psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc)); | 1787 | psrc = skb_put(skb, sizeof(*psrc)); |
1788 | *psrc = psf->sf_addr; | 1788 | *psrc = psf->sf_addr; |
1789 | scount++; stotal++; | 1789 | scount++; stotal++; |
1790 | if ((type == MLD2_ALLOW_NEW_SOURCES || | 1790 | if ((type == MLD2_ALLOW_NEW_SOURCES || |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index d310dc41209a..0327c1f2e6fc 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -528,7 +528,7 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr, | |||
528 | if (!skb) | 528 | if (!skb) |
529 | return; | 529 | return; |
530 | 530 | ||
531 | msg = (struct nd_msg *)skb_put(skb, sizeof(*msg)); | 531 | msg = skb_put(skb, sizeof(*msg)); |
532 | *msg = (struct nd_msg) { | 532 | *msg = (struct nd_msg) { |
533 | .icmph = { | 533 | .icmph = { |
534 | .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT, | 534 | .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT, |
@@ -597,7 +597,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit, | |||
597 | if (!skb) | 597 | if (!skb) |
598 | return; | 598 | return; |
599 | 599 | ||
600 | msg = (struct nd_msg *)skb_put(skb, sizeof(*msg)); | 600 | msg = skb_put(skb, sizeof(*msg)); |
601 | *msg = (struct nd_msg) { | 601 | *msg = (struct nd_msg) { |
602 | .icmph = { | 602 | .icmph = { |
603 | .icmp6_type = NDISC_NEIGHBOUR_SOLICITATION, | 603 | .icmp6_type = NDISC_NEIGHBOUR_SOLICITATION, |
@@ -657,7 +657,7 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, | |||
657 | if (!skb) | 657 | if (!skb) |
658 | return; | 658 | return; |
659 | 659 | ||
660 | msg = (struct rs_msg *)skb_put(skb, sizeof(*msg)); | 660 | msg = skb_put(skb, sizeof(*msg)); |
661 | *msg = (struct rs_msg) { | 661 | *msg = (struct rs_msg) { |
662 | .icmph = { | 662 | .icmph = { |
663 | .icmp6_type = NDISC_ROUTER_SOLICITATION, | 663 | .icmp6_type = NDISC_ROUTER_SOLICITATION, |
@@ -1633,7 +1633,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) | |||
1633 | if (!buff) | 1633 | if (!buff) |
1634 | goto release; | 1634 | goto release; |
1635 | 1635 | ||
1636 | msg = (struct rd_msg *)skb_put(buff, sizeof(*msg)); | 1636 | msg = skb_put(buff, sizeof(*msg)); |
1637 | *msg = (struct rd_msg) { | 1637 | *msg = (struct rd_msg) { |
1638 | .icmph = { | 1638 | .icmph = { |
1639 | .icmp6_type = NDISC_REDIRECT, | 1639 | .icmp6_type = NDISC_REDIRECT, |
diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c index d3c4daa708b9..ce203dd729e0 100644 --- a/net/ipv6/netfilter/ip6t_SYNPROXY.c +++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c | |||
@@ -27,7 +27,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, | |||
27 | struct ipv6hdr *iph; | 27 | struct ipv6hdr *iph; |
28 | 28 | ||
29 | skb_reset_network_header(skb); | 29 | skb_reset_network_header(skb); |
30 | iph = (struct ipv6hdr *)skb_put(skb, sizeof(*iph)); | 30 | iph = skb_put(skb, sizeof(*iph)); |
31 | ip6_flow_hdr(iph, 0, 0); | 31 | ip6_flow_hdr(iph, 0, 0); |
32 | iph->hop_limit = net->ipv6.devconf_all->hop_limit; | 32 | iph->hop_limit = net->ipv6.devconf_all->hop_limit; |
33 | iph->nexthdr = IPPROTO_TCP; | 33 | iph->nexthdr = IPPROTO_TCP; |
@@ -105,7 +105,7 @@ synproxy_send_client_synack(struct net *net, | |||
105 | niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); | 105 | niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); |
106 | 106 | ||
107 | skb_reset_transport_header(nskb); | 107 | skb_reset_transport_header(nskb); |
108 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 108 | nth = skb_put(nskb, tcp_hdr_size); |
109 | nth->source = th->dest; | 109 | nth->source = th->dest; |
110 | nth->dest = th->source; | 110 | nth->dest = th->source; |
111 | nth->seq = htonl(__cookie_v6_init_sequence(iph, th, &mss)); | 111 | nth->seq = htonl(__cookie_v6_init_sequence(iph, th, &mss)); |
@@ -147,7 +147,7 @@ synproxy_send_server_syn(struct net *net, | |||
147 | niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); | 147 | niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); |
148 | 148 | ||
149 | skb_reset_transport_header(nskb); | 149 | skb_reset_transport_header(nskb); |
150 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 150 | nth = skb_put(nskb, tcp_hdr_size); |
151 | nth->source = th->source; | 151 | nth->source = th->source; |
152 | nth->dest = th->dest; | 152 | nth->dest = th->dest; |
153 | nth->seq = htonl(recv_seq - 1); | 153 | nth->seq = htonl(recv_seq - 1); |
@@ -192,7 +192,7 @@ synproxy_send_server_ack(struct net *net, | |||
192 | niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); | 192 | niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr); |
193 | 193 | ||
194 | skb_reset_transport_header(nskb); | 194 | skb_reset_transport_header(nskb); |
195 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 195 | nth = skb_put(nskb, tcp_hdr_size); |
196 | nth->source = th->dest; | 196 | nth->source = th->dest; |
197 | nth->dest = th->source; | 197 | nth->dest = th->source; |
198 | nth->seq = htonl(ntohl(th->ack_seq)); | 198 | nth->seq = htonl(ntohl(th->ack_seq)); |
@@ -230,7 +230,7 @@ synproxy_send_client_ack(struct net *net, | |||
230 | niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); | 230 | niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr); |
231 | 231 | ||
232 | skb_reset_transport_header(nskb); | 232 | skb_reset_transport_header(nskb); |
233 | nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size); | 233 | nth = skb_put(nskb, tcp_hdr_size); |
234 | nth->source = th->source; | 234 | nth->source = th->source; |
235 | nth->dest = th->dest; | 235 | nth->dest = th->dest; |
236 | nth->seq = htonl(ntohl(th->seq) + 1); | 236 | nth->seq = htonl(ntohl(th->seq) + 1); |
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index f63b18e05c69..24858402e374 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c | |||
@@ -95,7 +95,7 @@ void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, | |||
95 | int needs_ack; | 95 | int needs_ack; |
96 | 96 | ||
97 | skb_reset_transport_header(nskb); | 97 | skb_reset_transport_header(nskb); |
98 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 98 | tcph = skb_put(nskb, sizeof(struct tcphdr)); |
99 | /* Truncate to length (no data) */ | 99 | /* Truncate to length (no data) */ |
100 | tcph->doff = sizeof(struct tcphdr)/4; | 100 | tcph->doff = sizeof(struct tcphdr)/4; |
101 | tcph->source = oth->dest; | 101 | tcph->source = oth->dest; |
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index bf56ac7dba96..82e71e5622c2 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -133,7 +133,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos) | |||
133 | if (!tx_skb) | 133 | if (!tx_skb) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | frame = (struct snrm_frame *) skb_put(tx_skb, 2); | 136 | frame = skb_put(tx_skb, 2); |
137 | 137 | ||
138 | /* Insert connection address field */ | 138 | /* Insert connection address field */ |
139 | if (qos) | 139 | if (qos) |
@@ -228,7 +228,7 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos) | |||
228 | if (!tx_skb) | 228 | if (!tx_skb) |
229 | return; | 229 | return; |
230 | 230 | ||
231 | frame = (struct ua_frame *) skb_put(tx_skb, 10); | 231 | frame = skb_put(tx_skb, 10); |
232 | 232 | ||
233 | /* Build UA response */ | 233 | /* Build UA response */ |
234 | frame->caddr = self->caddr; | 234 | frame->caddr = self->caddr; |
@@ -268,7 +268,7 @@ void irlap_send_dm_frame( struct irlap_cb *self) | |||
268 | if (!tx_skb) | 268 | if (!tx_skb) |
269 | return; | 269 | return; |
270 | 270 | ||
271 | frame = (struct dm_frame *)skb_put(tx_skb, 2); | 271 | frame = skb_put(tx_skb, 2); |
272 | 272 | ||
273 | if (self->state == LAP_NDM) | 273 | if (self->state == LAP_NDM) |
274 | frame->caddr = CBROADCAST; | 274 | frame->caddr = CBROADCAST; |
@@ -298,7 +298,7 @@ void irlap_send_disc_frame(struct irlap_cb *self) | |||
298 | if (!tx_skb) | 298 | if (!tx_skb) |
299 | return; | 299 | return; |
300 | 300 | ||
301 | frame = (struct disc_frame *)skb_put(tx_skb, 2); | 301 | frame = skb_put(tx_skb, 2); |
302 | 302 | ||
303 | frame->caddr = self->caddr | CMD_FRAME; | 303 | frame->caddr = self->caddr | CMD_FRAME; |
304 | frame->control = DISC_CMD | PF_BIT; | 304 | frame->control = DISC_CMD | PF_BIT; |
@@ -587,7 +587,7 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command) | |||
587 | if (!tx_skb) | 587 | if (!tx_skb) |
588 | return; | 588 | return; |
589 | 589 | ||
590 | frame = (struct rr_frame *)skb_put(tx_skb, 2); | 590 | frame = skb_put(tx_skb, 2); |
591 | 591 | ||
592 | frame->caddr = self->caddr; | 592 | frame->caddr = self->caddr; |
593 | frame->caddr |= (command) ? CMD_FRAME : 0; | 593 | frame->caddr |= (command) ? CMD_FRAME : 0; |
@@ -612,7 +612,7 @@ void irlap_send_rd_frame(struct irlap_cb *self) | |||
612 | if (!tx_skb) | 612 | if (!tx_skb) |
613 | return; | 613 | return; |
614 | 614 | ||
615 | frame = (struct rd_frame *)skb_put(tx_skb, 2); | 615 | frame = skb_put(tx_skb, 2); |
616 | 616 | ||
617 | frame->caddr = self->caddr; | 617 | frame->caddr = self->caddr; |
618 | frame->control = RD_RSP | PF_BIT; | 618 | frame->control = RD_RSP | PF_BIT; |
@@ -1202,14 +1202,13 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, | |||
1202 | 1202 | ||
1203 | /* Broadcast frames must include saddr and daddr fields */ | 1203 | /* Broadcast frames must include saddr and daddr fields */ |
1204 | if (caddr == CBROADCAST) { | 1204 | if (caddr == CBROADCAST) { |
1205 | frame = (struct test_frame *) | 1205 | frame = skb_put(tx_skb, sizeof(struct test_frame)); |
1206 | skb_put(tx_skb, sizeof(struct test_frame)); | ||
1207 | 1206 | ||
1208 | /* Insert the swapped addresses */ | 1207 | /* Insert the swapped addresses */ |
1209 | frame->saddr = cpu_to_le32(self->saddr); | 1208 | frame->saddr = cpu_to_le32(self->saddr); |
1210 | frame->daddr = cpu_to_le32(daddr); | 1209 | frame->daddr = cpu_to_le32(daddr); |
1211 | } else | 1210 | } else |
1212 | frame = (struct test_frame *) skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER); | 1211 | frame = skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER); |
1213 | 1212 | ||
1214 | frame->caddr = caddr; | 1213 | frame->caddr = caddr; |
1215 | frame->control = TEST_RSP | PF_BIT; | 1214 | frame->control = TEST_RSP | PF_BIT; |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 3ebb4268973b..daa4e90dc4db 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -349,7 +349,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk) | |||
349 | err = EINVAL; | 349 | err = EINVAL; |
350 | BUG_ON(err <= 0 || err >= 256); | 350 | BUG_ON(err <= 0 || err >= 256); |
351 | 351 | ||
352 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 352 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
353 | pfkey_hdr_dup(hdr, orig); | 353 | pfkey_hdr_dup(hdr, orig); |
354 | hdr->sadb_msg_errno = (uint8_t) err; | 354 | hdr->sadb_msg_errno = (uint8_t) err; |
355 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / | 355 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / |
@@ -810,12 +810,12 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
810 | return ERR_PTR(-ENOBUFS); | 810 | return ERR_PTR(-ENOBUFS); |
811 | 811 | ||
812 | /* call should fill header later */ | 812 | /* call should fill header later */ |
813 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 813 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
814 | memset(hdr, 0, size); /* XXX do we need this ? */ | 814 | memset(hdr, 0, size); /* XXX do we need this ? */ |
815 | hdr->sadb_msg_len = size / sizeof(uint64_t); | 815 | hdr->sadb_msg_len = size / sizeof(uint64_t); |
816 | 816 | ||
817 | /* sa */ | 817 | /* sa */ |
818 | sa = (struct sadb_sa *) skb_put(skb, sizeof(struct sadb_sa)); | 818 | sa = skb_put(skb, sizeof(struct sadb_sa)); |
819 | sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); | 819 | sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); |
820 | sa->sadb_sa_exttype = SADB_EXT_SA; | 820 | sa->sadb_sa_exttype = SADB_EXT_SA; |
821 | sa->sadb_sa_spi = x->id.spi; | 821 | sa->sadb_sa_spi = x->id.spi; |
@@ -862,8 +862,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
862 | 862 | ||
863 | /* hard time */ | 863 | /* hard time */ |
864 | if (hsc & 2) { | 864 | if (hsc & 2) { |
865 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 865 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
866 | sizeof(struct sadb_lifetime)); | ||
867 | lifetime->sadb_lifetime_len = | 866 | lifetime->sadb_lifetime_len = |
868 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 867 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
869 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; | 868 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; |
@@ -874,8 +873,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
874 | } | 873 | } |
875 | /* soft time */ | 874 | /* soft time */ |
876 | if (hsc & 1) { | 875 | if (hsc & 1) { |
877 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 876 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
878 | sizeof(struct sadb_lifetime)); | ||
879 | lifetime->sadb_lifetime_len = | 877 | lifetime->sadb_lifetime_len = |
880 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 878 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
881 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; | 879 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; |
@@ -885,8 +883,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
885 | lifetime->sadb_lifetime_usetime = x->lft.soft_use_expires_seconds; | 883 | lifetime->sadb_lifetime_usetime = x->lft.soft_use_expires_seconds; |
886 | } | 884 | } |
887 | /* current time */ | 885 | /* current time */ |
888 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 886 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
889 | sizeof(struct sadb_lifetime)); | ||
890 | lifetime->sadb_lifetime_len = | 887 | lifetime->sadb_lifetime_len = |
891 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 888 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
892 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; | 889 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; |
@@ -895,8 +892,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
895 | lifetime->sadb_lifetime_addtime = x->curlft.add_time; | 892 | lifetime->sadb_lifetime_addtime = x->curlft.add_time; |
896 | lifetime->sadb_lifetime_usetime = x->curlft.use_time; | 893 | lifetime->sadb_lifetime_usetime = x->curlft.use_time; |
897 | /* src address */ | 894 | /* src address */ |
898 | addr = (struct sadb_address*) skb_put(skb, | 895 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
899 | sizeof(struct sadb_address)+sockaddr_size); | ||
900 | addr->sadb_address_len = | 896 | addr->sadb_address_len = |
901 | (sizeof(struct sadb_address)+sockaddr_size)/ | 897 | (sizeof(struct sadb_address)+sockaddr_size)/ |
902 | sizeof(uint64_t); | 898 | sizeof(uint64_t); |
@@ -915,8 +911,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
915 | BUG(); | 911 | BUG(); |
916 | 912 | ||
917 | /* dst address */ | 913 | /* dst address */ |
918 | addr = (struct sadb_address*) skb_put(skb, | 914 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
919 | sizeof(struct sadb_address)+sockaddr_size); | ||
920 | addr->sadb_address_len = | 915 | addr->sadb_address_len = |
921 | (sizeof(struct sadb_address)+sockaddr_size)/ | 916 | (sizeof(struct sadb_address)+sockaddr_size)/ |
922 | sizeof(uint64_t); | 917 | sizeof(uint64_t); |
@@ -933,8 +928,8 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
933 | 928 | ||
934 | if (!xfrm_addr_equal(&x->sel.saddr, &x->props.saddr, | 929 | if (!xfrm_addr_equal(&x->sel.saddr, &x->props.saddr, |
935 | x->props.family)) { | 930 | x->props.family)) { |
936 | addr = (struct sadb_address*) skb_put(skb, | 931 | addr = skb_put(skb, |
937 | sizeof(struct sadb_address)+sockaddr_size); | 932 | sizeof(struct sadb_address) + sockaddr_size); |
938 | addr->sadb_address_len = | 933 | addr->sadb_address_len = |
939 | (sizeof(struct sadb_address)+sockaddr_size)/ | 934 | (sizeof(struct sadb_address)+sockaddr_size)/ |
940 | sizeof(uint64_t); | 935 | sizeof(uint64_t); |
@@ -951,8 +946,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
951 | 946 | ||
952 | /* auth key */ | 947 | /* auth key */ |
953 | if (add_keys && auth_key_size) { | 948 | if (add_keys && auth_key_size) { |
954 | key = (struct sadb_key *) skb_put(skb, | 949 | key = skb_put(skb, sizeof(struct sadb_key) + auth_key_size); |
955 | sizeof(struct sadb_key)+auth_key_size); | ||
956 | key->sadb_key_len = (sizeof(struct sadb_key) + auth_key_size) / | 950 | key->sadb_key_len = (sizeof(struct sadb_key) + auth_key_size) / |
957 | sizeof(uint64_t); | 951 | sizeof(uint64_t); |
958 | key->sadb_key_exttype = SADB_EXT_KEY_AUTH; | 952 | key->sadb_key_exttype = SADB_EXT_KEY_AUTH; |
@@ -962,8 +956,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
962 | } | 956 | } |
963 | /* encrypt key */ | 957 | /* encrypt key */ |
964 | if (add_keys && encrypt_key_size) { | 958 | if (add_keys && encrypt_key_size) { |
965 | key = (struct sadb_key *) skb_put(skb, | 959 | key = skb_put(skb, sizeof(struct sadb_key) + encrypt_key_size); |
966 | sizeof(struct sadb_key)+encrypt_key_size); | ||
967 | key->sadb_key_len = (sizeof(struct sadb_key) + | 960 | key->sadb_key_len = (sizeof(struct sadb_key) + |
968 | encrypt_key_size) / sizeof(uint64_t); | 961 | encrypt_key_size) / sizeof(uint64_t); |
969 | key->sadb_key_exttype = SADB_EXT_KEY_ENCRYPT; | 962 | key->sadb_key_exttype = SADB_EXT_KEY_ENCRYPT; |
@@ -974,7 +967,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
974 | } | 967 | } |
975 | 968 | ||
976 | /* sa */ | 969 | /* sa */ |
977 | sa2 = (struct sadb_x_sa2 *) skb_put(skb, sizeof(struct sadb_x_sa2)); | 970 | sa2 = skb_put(skb, sizeof(struct sadb_x_sa2)); |
978 | sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t); | 971 | sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t); |
979 | sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2; | 972 | sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2; |
980 | if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) { | 973 | if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) { |
@@ -992,7 +985,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
992 | struct sadb_x_nat_t_port *n_port; | 985 | struct sadb_x_nat_t_port *n_port; |
993 | 986 | ||
994 | /* type */ | 987 | /* type */ |
995 | n_type = (struct sadb_x_nat_t_type*) skb_put(skb, sizeof(*n_type)); | 988 | n_type = skb_put(skb, sizeof(*n_type)); |
996 | n_type->sadb_x_nat_t_type_len = sizeof(*n_type)/sizeof(uint64_t); | 989 | n_type->sadb_x_nat_t_type_len = sizeof(*n_type)/sizeof(uint64_t); |
997 | n_type->sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE; | 990 | n_type->sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE; |
998 | n_type->sadb_x_nat_t_type_type = natt->encap_type; | 991 | n_type->sadb_x_nat_t_type_type = natt->encap_type; |
@@ -1001,14 +994,14 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
1001 | n_type->sadb_x_nat_t_type_reserved[2] = 0; | 994 | n_type->sadb_x_nat_t_type_reserved[2] = 0; |
1002 | 995 | ||
1003 | /* source port */ | 996 | /* source port */ |
1004 | n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); | 997 | n_port = skb_put(skb, sizeof(*n_port)); |
1005 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); | 998 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); |
1006 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; | 999 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; |
1007 | n_port->sadb_x_nat_t_port_port = natt->encap_sport; | 1000 | n_port->sadb_x_nat_t_port_port = natt->encap_sport; |
1008 | n_port->sadb_x_nat_t_port_reserved = 0; | 1001 | n_port->sadb_x_nat_t_port_reserved = 0; |
1009 | 1002 | ||
1010 | /* dest port */ | 1003 | /* dest port */ |
1011 | n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); | 1004 | n_port = skb_put(skb, sizeof(*n_port)); |
1012 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); | 1005 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); |
1013 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; | 1006 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; |
1014 | n_port->sadb_x_nat_t_port_port = natt->encap_dport; | 1007 | n_port->sadb_x_nat_t_port_port = natt->encap_dport; |
@@ -1017,8 +1010,8 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x, | |||
1017 | 1010 | ||
1018 | /* security context */ | 1011 | /* security context */ |
1019 | if (xfrm_ctx) { | 1012 | if (xfrm_ctx) { |
1020 | sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, | 1013 | sec_ctx = skb_put(skb, |
1021 | sizeof(struct sadb_x_sec_ctx) + ctx_size); | 1014 | sizeof(struct sadb_x_sec_ctx) + ctx_size); |
1022 | sec_ctx->sadb_x_sec_len = | 1015 | sec_ctx->sadb_x_sec_len = |
1023 | (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); | 1016 | (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); |
1024 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; | 1017 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; |
@@ -1617,7 +1610,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, | |||
1617 | if (!skb) | 1610 | if (!skb) |
1618 | goto out_put_algs; | 1611 | goto out_put_algs; |
1619 | 1612 | ||
1620 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(*hdr)); | 1613 | hdr = skb_put(skb, sizeof(*hdr)); |
1621 | pfkey_hdr_dup(hdr, orig); | 1614 | pfkey_hdr_dup(hdr, orig); |
1622 | hdr->sadb_msg_errno = 0; | 1615 | hdr->sadb_msg_errno = 0; |
1623 | hdr->sadb_msg_len = len / sizeof(uint64_t); | 1616 | hdr->sadb_msg_len = len / sizeof(uint64_t); |
@@ -1626,7 +1619,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, | |||
1626 | struct sadb_supported *sp; | 1619 | struct sadb_supported *sp; |
1627 | struct sadb_alg *ap; | 1620 | struct sadb_alg *ap; |
1628 | 1621 | ||
1629 | sp = (struct sadb_supported *) skb_put(skb, auth_len); | 1622 | sp = skb_put(skb, auth_len); |
1630 | ap = (struct sadb_alg *) (sp + 1); | 1623 | ap = (struct sadb_alg *) (sp + 1); |
1631 | 1624 | ||
1632 | sp->sadb_supported_len = auth_len / sizeof(uint64_t); | 1625 | sp->sadb_supported_len = auth_len / sizeof(uint64_t); |
@@ -1647,7 +1640,7 @@ static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, | |||
1647 | struct sadb_supported *sp; | 1640 | struct sadb_supported *sp; |
1648 | struct sadb_alg *ap; | 1641 | struct sadb_alg *ap; |
1649 | 1642 | ||
1650 | sp = (struct sadb_supported *) skb_put(skb, enc_len); | 1643 | sp = skb_put(skb, enc_len); |
1651 | ap = (struct sadb_alg *) (sp + 1); | 1644 | ap = (struct sadb_alg *) (sp + 1); |
1652 | 1645 | ||
1653 | sp->sadb_supported_len = enc_len / sizeof(uint64_t); | 1646 | sp->sadb_supported_len = enc_len / sizeof(uint64_t); |
@@ -1721,7 +1714,7 @@ static int key_notify_sa_flush(const struct km_event *c) | |||
1721 | skb = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); | 1714 | skb = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); |
1722 | if (!skb) | 1715 | if (!skb) |
1723 | return -ENOBUFS; | 1716 | return -ENOBUFS; |
1724 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 1717 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
1725 | hdr->sadb_msg_satype = pfkey_proto2satype(c->data.proto); | 1718 | hdr->sadb_msg_satype = pfkey_proto2satype(c->data.proto); |
1726 | hdr->sadb_msg_type = SADB_FLUSH; | 1719 | hdr->sadb_msg_type = SADB_FLUSH; |
1727 | hdr->sadb_msg_seq = c->seq; | 1720 | hdr->sadb_msg_seq = c->seq; |
@@ -2046,12 +2039,11 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2046 | size = pfkey_xfrm_policy2msg_size(xp); | 2039 | size = pfkey_xfrm_policy2msg_size(xp); |
2047 | 2040 | ||
2048 | /* call should fill header later */ | 2041 | /* call should fill header later */ |
2049 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 2042 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
2050 | memset(hdr, 0, size); /* XXX do we need this ? */ | 2043 | memset(hdr, 0, size); /* XXX do we need this ? */ |
2051 | 2044 | ||
2052 | /* src address */ | 2045 | /* src address */ |
2053 | addr = (struct sadb_address*) skb_put(skb, | 2046 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
2054 | sizeof(struct sadb_address)+sockaddr_size); | ||
2055 | addr->sadb_address_len = | 2047 | addr->sadb_address_len = |
2056 | (sizeof(struct sadb_address)+sockaddr_size)/ | 2048 | (sizeof(struct sadb_address)+sockaddr_size)/ |
2057 | sizeof(uint64_t); | 2049 | sizeof(uint64_t); |
@@ -2066,8 +2058,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2066 | BUG(); | 2058 | BUG(); |
2067 | 2059 | ||
2068 | /* dst address */ | 2060 | /* dst address */ |
2069 | addr = (struct sadb_address*) skb_put(skb, | 2061 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
2070 | sizeof(struct sadb_address)+sockaddr_size); | ||
2071 | addr->sadb_address_len = | 2062 | addr->sadb_address_len = |
2072 | (sizeof(struct sadb_address)+sockaddr_size)/ | 2063 | (sizeof(struct sadb_address)+sockaddr_size)/ |
2073 | sizeof(uint64_t); | 2064 | sizeof(uint64_t); |
@@ -2081,8 +2072,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2081 | xp->family); | 2072 | xp->family); |
2082 | 2073 | ||
2083 | /* hard time */ | 2074 | /* hard time */ |
2084 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 2075 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
2085 | sizeof(struct sadb_lifetime)); | ||
2086 | lifetime->sadb_lifetime_len = | 2076 | lifetime->sadb_lifetime_len = |
2087 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 2077 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
2088 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; | 2078 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; |
@@ -2091,8 +2081,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2091 | lifetime->sadb_lifetime_addtime = xp->lft.hard_add_expires_seconds; | 2081 | lifetime->sadb_lifetime_addtime = xp->lft.hard_add_expires_seconds; |
2092 | lifetime->sadb_lifetime_usetime = xp->lft.hard_use_expires_seconds; | 2082 | lifetime->sadb_lifetime_usetime = xp->lft.hard_use_expires_seconds; |
2093 | /* soft time */ | 2083 | /* soft time */ |
2094 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 2084 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
2095 | sizeof(struct sadb_lifetime)); | ||
2096 | lifetime->sadb_lifetime_len = | 2085 | lifetime->sadb_lifetime_len = |
2097 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 2086 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
2098 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; | 2087 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; |
@@ -2101,8 +2090,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2101 | lifetime->sadb_lifetime_addtime = xp->lft.soft_add_expires_seconds; | 2090 | lifetime->sadb_lifetime_addtime = xp->lft.soft_add_expires_seconds; |
2102 | lifetime->sadb_lifetime_usetime = xp->lft.soft_use_expires_seconds; | 2091 | lifetime->sadb_lifetime_usetime = xp->lft.soft_use_expires_seconds; |
2103 | /* current time */ | 2092 | /* current time */ |
2104 | lifetime = (struct sadb_lifetime *) skb_put(skb, | 2093 | lifetime = skb_put(skb, sizeof(struct sadb_lifetime)); |
2105 | sizeof(struct sadb_lifetime)); | ||
2106 | lifetime->sadb_lifetime_len = | 2094 | lifetime->sadb_lifetime_len = |
2107 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); | 2095 | sizeof(struct sadb_lifetime)/sizeof(uint64_t); |
2108 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; | 2096 | lifetime->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT; |
@@ -2111,7 +2099,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2111 | lifetime->sadb_lifetime_addtime = xp->curlft.add_time; | 2099 | lifetime->sadb_lifetime_addtime = xp->curlft.add_time; |
2112 | lifetime->sadb_lifetime_usetime = xp->curlft.use_time; | 2100 | lifetime->sadb_lifetime_usetime = xp->curlft.use_time; |
2113 | 2101 | ||
2114 | pol = (struct sadb_x_policy *) skb_put(skb, sizeof(struct sadb_x_policy)); | 2102 | pol = skb_put(skb, sizeof(struct sadb_x_policy)); |
2115 | pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); | 2103 | pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); |
2116 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 2104 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
2117 | pol->sadb_x_policy_type = IPSEC_POLICY_DISCARD; | 2105 | pol->sadb_x_policy_type = IPSEC_POLICY_DISCARD; |
@@ -2139,7 +2127,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2139 | } else { | 2127 | } else { |
2140 | size -= 2*socklen; | 2128 | size -= 2*socklen; |
2141 | } | 2129 | } |
2142 | rq = (void*)skb_put(skb, req_size); | 2130 | rq = skb_put(skb, req_size); |
2143 | pol->sadb_x_policy_len += req_size/8; | 2131 | pol->sadb_x_policy_len += req_size/8; |
2144 | memset(rq, 0, sizeof(*rq)); | 2132 | memset(rq, 0, sizeof(*rq)); |
2145 | rq->sadb_x_ipsecrequest_len = req_size; | 2133 | rq->sadb_x_ipsecrequest_len = req_size; |
@@ -2169,7 +2157,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2169 | if ((xfrm_ctx = xp->security)) { | 2157 | if ((xfrm_ctx = xp->security)) { |
2170 | int ctx_size = pfkey_xfrm_policy2sec_ctx_size(xp); | 2158 | int ctx_size = pfkey_xfrm_policy2sec_ctx_size(xp); |
2171 | 2159 | ||
2172 | sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, ctx_size); | 2160 | sec_ctx = skb_put(skb, ctx_size); |
2173 | sec_ctx->sadb_x_sec_len = ctx_size / sizeof(uint64_t); | 2161 | sec_ctx->sadb_x_sec_len = ctx_size / sizeof(uint64_t); |
2174 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; | 2162 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; |
2175 | sec_ctx->sadb_x_ctx_doi = xfrm_ctx->ctx_doi; | 2163 | sec_ctx->sadb_x_ctx_doi = xfrm_ctx->ctx_doi; |
@@ -2733,7 +2721,7 @@ static int key_notify_policy_flush(const struct km_event *c) | |||
2733 | skb_out = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); | 2721 | skb_out = alloc_skb(sizeof(struct sadb_msg) + 16, GFP_ATOMIC); |
2734 | if (!skb_out) | 2722 | if (!skb_out) |
2735 | return -ENOBUFS; | 2723 | return -ENOBUFS; |
2736 | hdr = (struct sadb_msg *) skb_put(skb_out, sizeof(struct sadb_msg)); | 2724 | hdr = skb_put(skb_out, sizeof(struct sadb_msg)); |
2737 | hdr->sadb_msg_type = SADB_X_SPDFLUSH; | 2725 | hdr->sadb_msg_type = SADB_X_SPDFLUSH; |
2738 | hdr->sadb_msg_seq = c->seq; | 2726 | hdr->sadb_msg_seq = c->seq; |
2739 | hdr->sadb_msg_pid = c->portid; | 2727 | hdr->sadb_msg_pid = c->portid; |
@@ -2917,7 +2905,7 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) | |||
2917 | struct sadb_prop *p; | 2905 | struct sadb_prop *p; |
2918 | int i; | 2906 | int i; |
2919 | 2907 | ||
2920 | p = (struct sadb_prop*)skb_put(skb, sizeof(struct sadb_prop)); | 2908 | p = skb_put(skb, sizeof(struct sadb_prop)); |
2921 | p->sadb_prop_len = sizeof(struct sadb_prop)/8; | 2909 | p->sadb_prop_len = sizeof(struct sadb_prop)/8; |
2922 | p->sadb_prop_exttype = SADB_EXT_PROPOSAL; | 2910 | p->sadb_prop_exttype = SADB_EXT_PROPOSAL; |
2923 | p->sadb_prop_replay = 32; | 2911 | p->sadb_prop_replay = 32; |
@@ -2951,7 +2939,7 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) | |||
2951 | struct sadb_prop *p; | 2939 | struct sadb_prop *p; |
2952 | int i, k; | 2940 | int i, k; |
2953 | 2941 | ||
2954 | p = (struct sadb_prop*)skb_put(skb, sizeof(struct sadb_prop)); | 2942 | p = skb_put(skb, sizeof(struct sadb_prop)); |
2955 | p->sadb_prop_len = sizeof(struct sadb_prop)/8; | 2943 | p->sadb_prop_len = sizeof(struct sadb_prop)/8; |
2956 | p->sadb_prop_exttype = SADB_EXT_PROPOSAL; | 2944 | p->sadb_prop_exttype = SADB_EXT_PROPOSAL; |
2957 | p->sadb_prop_replay = 32; | 2945 | p->sadb_prop_replay = 32; |
@@ -2977,7 +2965,7 @@ static void dump_esp_combs(struct sk_buff *skb, const struct xfrm_tmpl *t) | |||
2977 | continue; | 2965 | continue; |
2978 | if (!(aalg_tmpl_set(t, aalg) && aalg->available)) | 2966 | if (!(aalg_tmpl_set(t, aalg) && aalg->available)) |
2979 | continue; | 2967 | continue; |
2980 | c = (struct sadb_comb*)skb_put(skb, sizeof(struct sadb_comb)); | 2968 | c = skb_put(skb, sizeof(struct sadb_comb)); |
2981 | memset(c, 0, sizeof(*c)); | 2969 | memset(c, 0, sizeof(*c)); |
2982 | p->sadb_prop_len += sizeof(struct sadb_comb)/8; | 2970 | p->sadb_prop_len += sizeof(struct sadb_comb)/8; |
2983 | c->sadb_comb_auth = aalg->desc.sadb_alg_id; | 2971 | c->sadb_comb_auth = aalg->desc.sadb_alg_id; |
@@ -3144,7 +3132,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3144 | if (skb == NULL) | 3132 | if (skb == NULL) |
3145 | return -ENOMEM; | 3133 | return -ENOMEM; |
3146 | 3134 | ||
3147 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 3135 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
3148 | hdr->sadb_msg_version = PF_KEY_V2; | 3136 | hdr->sadb_msg_version = PF_KEY_V2; |
3149 | hdr->sadb_msg_type = SADB_ACQUIRE; | 3137 | hdr->sadb_msg_type = SADB_ACQUIRE; |
3150 | hdr->sadb_msg_satype = pfkey_proto2satype(x->id.proto); | 3138 | hdr->sadb_msg_satype = pfkey_proto2satype(x->id.proto); |
@@ -3155,8 +3143,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3155 | hdr->sadb_msg_pid = 0; | 3143 | hdr->sadb_msg_pid = 0; |
3156 | 3144 | ||
3157 | /* src address */ | 3145 | /* src address */ |
3158 | addr = (struct sadb_address*) skb_put(skb, | 3146 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
3159 | sizeof(struct sadb_address)+sockaddr_size); | ||
3160 | addr->sadb_address_len = | 3147 | addr->sadb_address_len = |
3161 | (sizeof(struct sadb_address)+sockaddr_size)/ | 3148 | (sizeof(struct sadb_address)+sockaddr_size)/ |
3162 | sizeof(uint64_t); | 3149 | sizeof(uint64_t); |
@@ -3171,8 +3158,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3171 | BUG(); | 3158 | BUG(); |
3172 | 3159 | ||
3173 | /* dst address */ | 3160 | /* dst address */ |
3174 | addr = (struct sadb_address*) skb_put(skb, | 3161 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
3175 | sizeof(struct sadb_address)+sockaddr_size); | ||
3176 | addr->sadb_address_len = | 3162 | addr->sadb_address_len = |
3177 | (sizeof(struct sadb_address)+sockaddr_size)/ | 3163 | (sizeof(struct sadb_address)+sockaddr_size)/ |
3178 | sizeof(uint64_t); | 3164 | sizeof(uint64_t); |
@@ -3186,7 +3172,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3186 | if (!addr->sadb_address_prefixlen) | 3172 | if (!addr->sadb_address_prefixlen) |
3187 | BUG(); | 3173 | BUG(); |
3188 | 3174 | ||
3189 | pol = (struct sadb_x_policy *) skb_put(skb, sizeof(struct sadb_x_policy)); | 3175 | pol = skb_put(skb, sizeof(struct sadb_x_policy)); |
3190 | pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); | 3176 | pol->sadb_x_policy_len = sizeof(struct sadb_x_policy)/sizeof(uint64_t); |
3191 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3177 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3192 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3178 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
@@ -3203,8 +3189,8 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3203 | 3189 | ||
3204 | /* security context */ | 3190 | /* security context */ |
3205 | if (xfrm_ctx) { | 3191 | if (xfrm_ctx) { |
3206 | sec_ctx = (struct sadb_x_sec_ctx *) skb_put(skb, | 3192 | sec_ctx = skb_put(skb, |
3207 | sizeof(struct sadb_x_sec_ctx) + ctx_size); | 3193 | sizeof(struct sadb_x_sec_ctx) + ctx_size); |
3208 | sec_ctx->sadb_x_sec_len = | 3194 | sec_ctx->sadb_x_sec_len = |
3209 | (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); | 3195 | (sizeof(struct sadb_x_sec_ctx) + ctx_size) / sizeof(uint64_t); |
3210 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; | 3196 | sec_ctx->sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX; |
@@ -3346,7 +3332,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3346 | if (skb == NULL) | 3332 | if (skb == NULL) |
3347 | return -ENOMEM; | 3333 | return -ENOMEM; |
3348 | 3334 | ||
3349 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 3335 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
3350 | hdr->sadb_msg_version = PF_KEY_V2; | 3336 | hdr->sadb_msg_version = PF_KEY_V2; |
3351 | hdr->sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING; | 3337 | hdr->sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING; |
3352 | hdr->sadb_msg_satype = satype; | 3338 | hdr->sadb_msg_satype = satype; |
@@ -3357,7 +3343,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3357 | hdr->sadb_msg_pid = 0; | 3343 | hdr->sadb_msg_pid = 0; |
3358 | 3344 | ||
3359 | /* SA */ | 3345 | /* SA */ |
3360 | sa = (struct sadb_sa *) skb_put(skb, sizeof(struct sadb_sa)); | 3346 | sa = skb_put(skb, sizeof(struct sadb_sa)); |
3361 | sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); | 3347 | sa->sadb_sa_len = sizeof(struct sadb_sa)/sizeof(uint64_t); |
3362 | sa->sadb_sa_exttype = SADB_EXT_SA; | 3348 | sa->sadb_sa_exttype = SADB_EXT_SA; |
3363 | sa->sadb_sa_spi = x->id.spi; | 3349 | sa->sadb_sa_spi = x->id.spi; |
@@ -3368,8 +3354,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3368 | sa->sadb_sa_flags = 0; | 3354 | sa->sadb_sa_flags = 0; |
3369 | 3355 | ||
3370 | /* ADDRESS_SRC (old addr) */ | 3356 | /* ADDRESS_SRC (old addr) */ |
3371 | addr = (struct sadb_address*) | 3357 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
3372 | skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); | ||
3373 | addr->sadb_address_len = | 3358 | addr->sadb_address_len = |
3374 | (sizeof(struct sadb_address)+sockaddr_size)/ | 3359 | (sizeof(struct sadb_address)+sockaddr_size)/ |
3375 | sizeof(uint64_t); | 3360 | sizeof(uint64_t); |
@@ -3384,15 +3369,14 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3384 | BUG(); | 3369 | BUG(); |
3385 | 3370 | ||
3386 | /* NAT_T_SPORT (old port) */ | 3371 | /* NAT_T_SPORT (old port) */ |
3387 | n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); | 3372 | n_port = skb_put(skb, sizeof(*n_port)); |
3388 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); | 3373 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); |
3389 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; | 3374 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; |
3390 | n_port->sadb_x_nat_t_port_port = natt->encap_sport; | 3375 | n_port->sadb_x_nat_t_port_port = natt->encap_sport; |
3391 | n_port->sadb_x_nat_t_port_reserved = 0; | 3376 | n_port->sadb_x_nat_t_port_reserved = 0; |
3392 | 3377 | ||
3393 | /* ADDRESS_DST (new addr) */ | 3378 | /* ADDRESS_DST (new addr) */ |
3394 | addr = (struct sadb_address*) | 3379 | addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); |
3395 | skb_put(skb, sizeof(struct sadb_address)+sockaddr_size); | ||
3396 | addr->sadb_address_len = | 3380 | addr->sadb_address_len = |
3397 | (sizeof(struct sadb_address)+sockaddr_size)/ | 3381 | (sizeof(struct sadb_address)+sockaddr_size)/ |
3398 | sizeof(uint64_t); | 3382 | sizeof(uint64_t); |
@@ -3407,7 +3391,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
3407 | BUG(); | 3391 | BUG(); |
3408 | 3392 | ||
3409 | /* NAT_T_DPORT (new port) */ | 3393 | /* NAT_T_DPORT (new port) */ |
3410 | n_port = (struct sadb_x_nat_t_port*) skb_put(skb, sizeof (*n_port)); | 3394 | n_port = skb_put(skb, sizeof(*n_port)); |
3411 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); | 3395 | n_port->sadb_x_nat_t_port_len = sizeof(*n_port)/sizeof(uint64_t); |
3412 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; | 3396 | n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; |
3413 | n_port->sadb_x_nat_t_port_port = sport; | 3397 | n_port->sadb_x_nat_t_port_port = sport; |
@@ -3421,7 +3405,7 @@ static int set_sadb_address(struct sk_buff *skb, int sasize, int type, | |||
3421 | const struct xfrm_selector *sel) | 3405 | const struct xfrm_selector *sel) |
3422 | { | 3406 | { |
3423 | struct sadb_address *addr; | 3407 | struct sadb_address *addr; |
3424 | addr = (struct sadb_address *)skb_put(skb, sizeof(struct sadb_address) + sasize); | 3408 | addr = skb_put(skb, sizeof(struct sadb_address) + sasize); |
3425 | addr->sadb_address_len = (sizeof(struct sadb_address) + sasize)/8; | 3409 | addr->sadb_address_len = (sizeof(struct sadb_address) + sasize)/8; |
3426 | addr->sadb_address_exttype = type; | 3410 | addr->sadb_address_exttype = type; |
3427 | addr->sadb_address_proto = sel->proto; | 3411 | addr->sadb_address_proto = sel->proto; |
@@ -3553,7 +3537,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3553 | if (skb == NULL) | 3537 | if (skb == NULL) |
3554 | return -ENOMEM; | 3538 | return -ENOMEM; |
3555 | 3539 | ||
3556 | hdr = (struct sadb_msg *)skb_put(skb, sizeof(struct sadb_msg)); | 3540 | hdr = skb_put(skb, sizeof(struct sadb_msg)); |
3557 | hdr->sadb_msg_version = PF_KEY_V2; | 3541 | hdr->sadb_msg_version = PF_KEY_V2; |
3558 | hdr->sadb_msg_type = SADB_X_MIGRATE; | 3542 | hdr->sadb_msg_type = SADB_X_MIGRATE; |
3559 | hdr->sadb_msg_satype = pfkey_proto2satype(m->proto); | 3543 | hdr->sadb_msg_satype = pfkey_proto2satype(m->proto); |
@@ -3574,7 +3558,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3574 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_DST, sel); | 3558 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_DST, sel); |
3575 | 3559 | ||
3576 | /* policy information */ | 3560 | /* policy information */ |
3577 | pol = (struct sadb_x_policy *)skb_put(skb, sizeof(struct sadb_x_policy)); | 3561 | pol = skb_put(skb, sizeof(struct sadb_x_policy)); |
3578 | pol->sadb_x_policy_len = size_pol / 8; | 3562 | pol->sadb_x_policy_len = size_pol / 8; |
3579 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3563 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3580 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3564 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index f9eb2486d550..a354f1939e49 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1107,7 +1107,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) | |||
1107 | skb = dev_alloc_skb(sizeof(*msg)); | 1107 | skb = dev_alloc_skb(sizeof(*msg)); |
1108 | if (!skb) | 1108 | if (!skb) |
1109 | return; | 1109 | return; |
1110 | msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); | 1110 | msg = skb_put(skb, sizeof(*msg)); |
1111 | 1111 | ||
1112 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) | 1112 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) |
1113 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ | 1113 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ |
@@ -3414,7 +3414,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, | |||
3414 | 3414 | ||
3415 | skb_reserve(skb, local->hw.extra_tx_headroom); | 3415 | skb_reserve(skb, local->hw.extra_tx_headroom); |
3416 | 3416 | ||
3417 | nullfunc = (void *) skb_put(skb, size); | 3417 | nullfunc = skb_put(skb, size); |
3418 | nullfunc->frame_control = fc; | 3418 | nullfunc->frame_control = fc; |
3419 | nullfunc->duration_id = 0; | 3419 | nullfunc->duration_id = 0; |
3420 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); | 3420 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); |
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 927215d4dd8f..c92df492e898 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -459,7 +459,7 @@ int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, | |||
459 | return -ENOMEM; | 459 | return -ENOMEM; |
460 | 460 | ||
461 | skb_reserve(skb, local->hw.extra_tx_headroom); | 461 | skb_reserve(skb, local->hw.extra_tx_headroom); |
462 | action_frame = (void *)skb_put(skb, 27); | 462 | action_frame = skb_put(skb, 27); |
463 | memcpy(action_frame->da, da, ETH_ALEN); | 463 | memcpy(action_frame->da, da, ETH_ALEN); |
464 | memcpy(action_frame->sa, sdata->dev->dev_addr, ETH_ALEN); | 464 | memcpy(action_frame->sa, sdata->dev->dev_addr, ETH_ALEN); |
465 | memcpy(action_frame->bssid, bssid, ETH_ALEN); | 465 | memcpy(action_frame->bssid, bssid, ETH_ALEN); |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 861697f2d75b..a550c707cd8a 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -1265,7 +1265,7 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, | |||
1265 | if (!skb) | 1265 | if (!skb) |
1266 | return -ENOMEM; | 1266 | return -ENOMEM; |
1267 | skb_reserve(skb, local->tx_headroom); | 1267 | skb_reserve(skb, local->tx_headroom); |
1268 | mgmt_fwd = (struct ieee80211_mgmt *) skb_put(skb, len); | 1268 | mgmt_fwd = skb_put(skb, len); |
1269 | 1269 | ||
1270 | /* offset_ttl is based on whether the secondary channel | 1270 | /* offset_ttl is based on whether the secondary channel |
1271 | * offset is available or not. Subtract 1 from the mesh TTL | 1271 | * offset is available or not. Subtract 1 from the mesh TTL |
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 96c987e641b3..d8cd91424175 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c | |||
@@ -30,7 +30,7 @@ static struct sk_buff *mps_qos_null_get(struct sta_info *sta) | |||
30 | return NULL; | 30 | return NULL; |
31 | skb_reserve(skb, local->hw.extra_tx_headroom); | 31 | skb_reserve(skb, local->hw.extra_tx_headroom); |
32 | 32 | ||
33 | nullfunc = (struct ieee80211_hdr *) skb_put(skb, size); | 33 | nullfunc = skb_put(skb, size); |
34 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); | 34 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); |
35 | ieee80211_fill_mesh_addresses(nullfunc, &fc, sta->sta.addr, | 35 | ieee80211_fill_mesh_addresses(nullfunc, &fc, sta->sta.addr, |
36 | sdata->vif.addr); | 36 | sdata->vif.addr); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 46e1809356f6..69615016d5bf 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1312,7 +1312,7 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid, | |||
1312 | 1312 | ||
1313 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1313 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1314 | 1314 | ||
1315 | nullfunc = (void *) skb_put(skb, size); | 1315 | nullfunc = skb_put(skb, size); |
1316 | nullfunc->frame_control = fc; | 1316 | nullfunc->frame_control = fc; |
1317 | nullfunc->duration_id = 0; | 1317 | nullfunc->duration_id = 0; |
1318 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); | 1318 | memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); |
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 86740670102d..709ef02fe67e 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c | |||
@@ -49,7 +49,7 @@ static void ieee80211_tdls_add_ext_capab(struct ieee80211_sub_if_data *sdata, | |||
49 | !ifmgd->tdls_wider_bw_prohibited; | 49 | !ifmgd->tdls_wider_bw_prohibited; |
50 | struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata); | 50 | struct ieee80211_supported_band *sband = ieee80211_get_sband(sdata); |
51 | bool vht = sband && sband->vht_cap.vht_supported; | 51 | bool vht = sband && sband->vht_cap.vht_supported; |
52 | u8 *pos = (void *)skb_put(skb, 10); | 52 | u8 *pos = skb_put(skb, 10); |
53 | 53 | ||
54 | *pos++ = WLAN_EID_EXT_CAPABILITY; | 54 | *pos++ = WLAN_EID_EXT_CAPABILITY; |
55 | *pos++ = 8; /* len */ | 55 | *pos++ = 8; /* len */ |
@@ -168,7 +168,7 @@ static void ieee80211_tdls_add_oper_classes(struct ieee80211_sub_if_data *sdata, | |||
168 | 168 | ||
169 | static void ieee80211_tdls_add_bss_coex_ie(struct sk_buff *skb) | 169 | static void ieee80211_tdls_add_bss_coex_ie(struct sk_buff *skb) |
170 | { | 170 | { |
171 | u8 *pos = (void *)skb_put(skb, 3); | 171 | u8 *pos = skb_put(skb, 3); |
172 | 172 | ||
173 | *pos++ = WLAN_EID_BSS_COEX_2040; | 173 | *pos++ = WLAN_EID_BSS_COEX_2040; |
174 | *pos++ = 1; /* len */ | 174 | *pos++ = 1; /* len */ |
@@ -209,7 +209,7 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata, | |||
209 | rsp_addr = sdata->vif.addr; | 209 | rsp_addr = sdata->vif.addr; |
210 | } | 210 | } |
211 | 211 | ||
212 | lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); | 212 | lnkid = skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); |
213 | 213 | ||
214 | lnkid->ie_type = WLAN_EID_LINK_ID; | 214 | lnkid->ie_type = WLAN_EID_LINK_ID; |
215 | lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; | 215 | lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; |
@@ -223,7 +223,7 @@ static void | |||
223 | ieee80211_tdls_add_aid(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | 223 | ieee80211_tdls_add_aid(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) |
224 | { | 224 | { |
225 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 225 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
226 | u8 *pos = (void *)skb_put(skb, 4); | 226 | u8 *pos = skb_put(skb, 4); |
227 | 227 | ||
228 | *pos++ = WLAN_EID_AID; | 228 | *pos++ = WLAN_EID_AID; |
229 | *pos++ = 2; /* len */ | 229 | *pos++ = 2; /* len */ |
@@ -745,7 +745,7 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
745 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 745 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
746 | struct ieee80211_tdls_data *tf; | 746 | struct ieee80211_tdls_data *tf; |
747 | 747 | ||
748 | tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); | 748 | tf = skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); |
749 | 749 | ||
750 | memcpy(tf->da, peer, ETH_ALEN); | 750 | memcpy(tf->da, peer, ETH_ALEN); |
751 | memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); | 751 | memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 18c5d6e6305d..ec5a9a72797e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -3874,7 +3874,7 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, | |||
3874 | ps->dtim_count--; | 3874 | ps->dtim_count--; |
3875 | } | 3875 | } |
3876 | 3876 | ||
3877 | tim = pos = (u8 *) skb_put(skb, 6); | 3877 | tim = pos = skb_put(skb, 6); |
3878 | *pos++ = WLAN_EID_TIM; | 3878 | *pos++ = WLAN_EID_TIM; |
3879 | *pos++ = 4; | 3879 | *pos++ = 4; |
3880 | *pos++ = ps->dtim_count; | 3880 | *pos++ = ps->dtim_count; |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index cc19614ff4e6..0d722ea98a1b 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -949,7 +949,7 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx) | |||
949 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) | 949 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
950 | return TX_DROP; | 950 | return TX_DROP; |
951 | 951 | ||
952 | mmie = (struct ieee80211_mmie *) skb_put(skb, sizeof(*mmie)); | 952 | mmie = skb_put(skb, sizeof(*mmie)); |
953 | mmie->element_id = WLAN_EID_MMIE; | 953 | mmie->element_id = WLAN_EID_MMIE; |
954 | mmie->length = sizeof(*mmie) - 2; | 954 | mmie->length = sizeof(*mmie) - 2; |
955 | mmie->key_id = cpu_to_le16(key->conf.keyidx); | 955 | mmie->key_id = cpu_to_le16(key->conf.keyidx); |
@@ -993,7 +993,7 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx) | |||
993 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) | 993 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
994 | return TX_DROP; | 994 | return TX_DROP; |
995 | 995 | ||
996 | mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie)); | 996 | mmie = skb_put(skb, sizeof(*mmie)); |
997 | mmie->element_id = WLAN_EID_MMIE; | 997 | mmie->element_id = WLAN_EID_MMIE; |
998 | mmie->length = sizeof(*mmie) - 2; | 998 | mmie->length = sizeof(*mmie) - 2; |
999 | mmie->key_id = cpu_to_le16(key->conf.keyidx); | 999 | mmie->key_id = cpu_to_le16(key->conf.keyidx); |
@@ -1138,7 +1138,7 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx) | |||
1138 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) | 1138 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
1139 | return TX_DROP; | 1139 | return TX_DROP; |
1140 | 1140 | ||
1141 | mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie)); | 1141 | mmie = skb_put(skb, sizeof(*mmie)); |
1142 | mmie->element_id = WLAN_EID_MMIE; | 1142 | mmie->element_id = WLAN_EID_MMIE; |
1143 | mmie->length = sizeof(*mmie) - 2; | 1143 | mmie->length = sizeof(*mmie) - 2; |
1144 | mmie->key_id = cpu_to_le16(key->conf.keyidx); | 1144 | mmie->key_id = cpu_to_le16(key->conf.keyidx); |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index da9704971a83..94ec0d0765a8 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -590,7 +590,7 @@ __build_packet_message(struct nfnl_log_net *log, | |||
590 | if (skb_tailroom(inst->skb) < nla_total_size(data_len)) | 590 | if (skb_tailroom(inst->skb) < nla_total_size(data_len)) |
591 | goto nla_put_failure; | 591 | goto nla_put_failure; |
592 | 592 | ||
593 | nla = (struct nlattr *)skb_put(inst->skb, nla_total_size(data_len)); | 593 | nla = skb_put(inst->skb, nla_total_size(data_len)); |
594 | nla->nla_type = NFULA_PAYLOAD; | 594 | nla->nla_type = NFULA_PAYLOAD; |
595 | nla->nla_len = size; | 595 | nla->nla_len = size; |
596 | 596 | ||
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 8a0f218b7938..1b17a1b445a3 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -589,7 +589,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, | |||
589 | if (skb_tailroom(skb) < sizeof(*nla) + hlen) | 589 | if (skb_tailroom(skb) < sizeof(*nla) + hlen) |
590 | goto nla_put_failure; | 590 | goto nla_put_failure; |
591 | 591 | ||
592 | nla = (struct nlattr *)skb_put(skb, sizeof(*nla)); | 592 | nla = skb_put(skb, sizeof(*nla)); |
593 | nla->nla_type = NFQA_PAYLOAD; | 593 | nla->nla_type = NFQA_PAYLOAD; |
594 | nla->nla_len = nla_attr_size(data_len); | 594 | nla->nla_len = nla_attr_size(data_len); |
595 | 595 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index bd24a975fd49..a88745e4b7df 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -2104,7 +2104,7 @@ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int fla | |||
2104 | struct nlmsghdr *nlh; | 2104 | struct nlmsghdr *nlh; |
2105 | int size = nlmsg_msg_size(len); | 2105 | int size = nlmsg_msg_size(len); |
2106 | 2106 | ||
2107 | nlh = (struct nlmsghdr *)skb_put(skb, NLMSG_ALIGN(size)); | 2107 | nlh = skb_put(skb, NLMSG_ALIGN(size)); |
2108 | nlh->nlmsg_type = type; | 2108 | nlh->nlmsg_type = type; |
2109 | nlh->nlmsg_len = size; | 2109 | nlh->nlmsg_len = size; |
2110 | nlh->nlmsg_flags = flags; | 2110 | nlh->nlmsg_flags = flags; |
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index 0fd5518bf252..fec47a7d0092 100644 --- a/net/nfc/digital_core.c +++ b/net/nfc/digital_core.c | |||
@@ -74,8 +74,8 @@ void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init, | |||
74 | if (msb_first) | 74 | if (msb_first) |
75 | crc = __fswab16(crc); | 75 | crc = __fswab16(crc); |
76 | 76 | ||
77 | *skb_put(skb, 1) = crc & 0xFF; | 77 | *(u8 *)skb_put(skb, 1) = crc & 0xFF; |
78 | *skb_put(skb, 1) = (crc >> 8) & 0xFF; | 78 | *(u8 *)skb_put(skb, 1) = (crc >> 8) & 0xFF; |
79 | } | 79 | } |
80 | 80 | ||
81 | int digital_skb_check_crc(struct sk_buff *skb, crc_func_t crc_func, | 81 | int digital_skb_check_crc(struct sk_buff *skb, crc_func_t crc_func, |
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index f44f75a2a4d5..82471af5553e 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c | |||
@@ -654,7 +654,7 @@ static int digital_in_send_rtox(struct nfc_digital_dev *ddev, | |||
654 | if (!skb) | 654 | if (!skb) |
655 | return -ENOMEM; | 655 | return -ENOMEM; |
656 | 656 | ||
657 | *skb_put(skb, 1) = rtox; | 657 | *(u8 *)skb_put(skb, 1) = rtox; |
658 | 658 | ||
659 | skb_push(skb, sizeof(struct digital_dep_req_res)); | 659 | skb_push(skb, sizeof(struct digital_dep_req_res)); |
660 | 660 | ||
diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c index d9080dec5d27..fae6d31b377c 100644 --- a/net/nfc/digital_technology.c +++ b/net/nfc/digital_technology.c | |||
@@ -266,8 +266,8 @@ static int digital_in_send_rats(struct nfc_digital_dev *ddev, | |||
266 | if (!skb) | 266 | if (!skb) |
267 | return -ENOMEM; | 267 | return -ENOMEM; |
268 | 268 | ||
269 | *skb_put(skb, 1) = DIGITAL_RATS_BYTE1; | 269 | *(u8 *)skb_put(skb, 1) = DIGITAL_RATS_BYTE1; |
270 | *skb_put(skb, 1) = DIGITAL_RATS_PARAM; | 270 | *(u8 *)skb_put(skb, 1) = DIGITAL_RATS_PARAM; |
271 | 271 | ||
272 | rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_ats, | 272 | rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_ats, |
273 | target); | 273 | target); |
@@ -470,8 +470,8 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, | |||
470 | else | 470 | else |
471 | sel_cmd = DIGITAL_CMD_SEL_REQ_CL3; | 471 | sel_cmd = DIGITAL_CMD_SEL_REQ_CL3; |
472 | 472 | ||
473 | *skb_put(skb, sizeof(u8)) = sel_cmd; | 473 | *(u8 *)skb_put(skb, sizeof(u8)) = sel_cmd; |
474 | *skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR; | 474 | *(u8 *)skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR; |
475 | 475 | ||
476 | return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, | 476 | return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, |
477 | target); | 477 | target); |
@@ -541,7 +541,7 @@ int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech) | |||
541 | if (!skb) | 541 | if (!skb) |
542 | return -ENOMEM; | 542 | return -ENOMEM; |
543 | 543 | ||
544 | *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ; | 544 | *(u8 *)skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ; |
545 | 545 | ||
546 | rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL); | 546 | rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL); |
547 | if (rc) | 547 | if (rc) |
@@ -625,8 +625,7 @@ static int digital_in_send_attrib_req(struct nfc_digital_dev *ddev, | |||
625 | if (!skb) | 625 | if (!skb) |
626 | return -ENOMEM; | 626 | return -ENOMEM; |
627 | 627 | ||
628 | attrib_req = (struct digital_attrib_req *)skb_put(skb, | 628 | attrib_req = skb_put(skb, sizeof(*attrib_req)); |
629 | sizeof(*attrib_req)); | ||
630 | 629 | ||
631 | attrib_req->cmd = DIGITAL_CMD_ATTRIB_REQ; | 630 | attrib_req->cmd = DIGITAL_CMD_ATTRIB_REQ; |
632 | memcpy(attrib_req->nfcid0, sensb_res->nfcid0, | 631 | memcpy(attrib_req->nfcid0, sensb_res->nfcid0, |
@@ -730,8 +729,7 @@ int digital_in_send_sensb_req(struct nfc_digital_dev *ddev, u8 rf_tech) | |||
730 | if (!skb) | 729 | if (!skb) |
731 | return -ENOMEM; | 730 | return -ENOMEM; |
732 | 731 | ||
733 | sensb_req = (struct digital_sensb_req *)skb_put(skb, | 732 | sensb_req = skb_put(skb, sizeof(*sensb_req)); |
734 | sizeof(*sensb_req)); | ||
735 | 733 | ||
736 | sensb_req->cmd = DIGITAL_CMD_SENSB_REQ; | 734 | sensb_req->cmd = DIGITAL_CMD_SENSB_REQ; |
737 | sensb_req->afi = 0x00; /* All families and sub-families */ | 735 | sensb_req->afi = 0x00; /* All families and sub-families */ |
@@ -939,7 +937,7 @@ static int digital_tg_send_sel_res(struct nfc_digital_dev *ddev) | |||
939 | if (!skb) | 937 | if (!skb) |
940 | return -ENOMEM; | 938 | return -ENOMEM; |
941 | 939 | ||
942 | *skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP; | 940 | *(u8 *)skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP; |
943 | 941 | ||
944 | if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) | 942 | if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) |
945 | digital_skb_add_crc_a(skb); | 943 | digital_skb_add_crc_a(skb); |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 8741ad47a6fb..3a0c94590411 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -874,7 +874,7 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) | |||
874 | return; | 874 | return; |
875 | } | 875 | } |
876 | 876 | ||
877 | *skb_put(hcp_skb, NFC_HCI_HCP_PACKET_HEADER_LEN) = pipe; | 877 | *(u8 *)skb_put(hcp_skb, NFC_HCI_HCP_PACKET_HEADER_LEN) = pipe; |
878 | 878 | ||
879 | skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { | 879 | skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { |
880 | msg_len = frag_skb->len - NFC_HCI_HCP_PACKET_HEADER_LEN; | 880 | msg_len = frag_skb->len - NFC_HCI_HCP_PACKET_HEADER_LEN; |
diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c index 401c7e255273..9ab4a05f086f 100644 --- a/net/nfc/hci/llc_shdlc.c +++ b/net/nfc/hci/llc_shdlc.c | |||
@@ -382,8 +382,8 @@ static int llc_shdlc_connect_initiate(struct llc_shdlc *shdlc) | |||
382 | if (skb == NULL) | 382 | if (skb == NULL) |
383 | return -ENOMEM; | 383 | return -ENOMEM; |
384 | 384 | ||
385 | *skb_put(skb, 1) = SHDLC_MAX_WINDOW; | 385 | *(u8 *)skb_put(skb, 1) = SHDLC_MAX_WINDOW; |
386 | *skb_put(skb, 1) = SHDLC_SREJ_SUPPORT ? 1 : 0; | 386 | *(u8 *)skb_put(skb, 1) = SHDLC_SREJ_SUPPORT ? 1 : 0; |
387 | 387 | ||
388 | return llc_shdlc_send_u_frame(shdlc, skb, U_FRAME_RSET); | 388 | return llc_shdlc_send_u_frame(shdlc, skb, U_FRAME_RSET); |
389 | } | 389 | } |
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 17b9f1ce23db..a3dac34cf790 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -1341,7 +1341,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload) | |||
1341 | return -ENOMEM; | 1341 | return -ENOMEM; |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | hdr = (struct nci_ctrl_hdr *) skb_put(skb, NCI_CTRL_HDR_SIZE); | 1344 | hdr = skb_put(skb, NCI_CTRL_HDR_SIZE); |
1345 | hdr->gid = nci_opcode_gid(opcode); | 1345 | hdr->gid = nci_opcode_gid(opcode); |
1346 | hdr->oid = nci_opcode_oid(opcode); | 1346 | hdr->oid = nci_opcode_oid(opcode); |
1347 | hdr->plen = plen; | 1347 | hdr->plen = plen; |
diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c index d4a53ce818c3..d1119bb35f24 100644 --- a/net/nfc/nci/hci.c +++ b/net/nfc/nci/hci.c | |||
@@ -472,7 +472,7 @@ void nci_hci_data_received_cb(void *context, | |||
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | 474 | ||
475 | *skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; | 475 | *(u8 *)skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; |
476 | 476 | ||
477 | skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { | 477 | skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { |
478 | msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; | 478 | msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; |
diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c index d904cd2f1442..a502a334918a 100644 --- a/net/nfc/nci/spi.c +++ b/net/nfc/nci/spi.c | |||
@@ -86,8 +86,8 @@ int nci_spi_send(struct nci_spi *nspi, | |||
86 | u16 crc; | 86 | u16 crc; |
87 | 87 | ||
88 | crc = crc_ccitt(CRC_INIT, skb->data, skb->len); | 88 | crc = crc_ccitt(CRC_INIT, skb->data, skb->len); |
89 | *skb_put(skb, 1) = crc >> 8; | 89 | *(u8 *)skb_put(skb, 1) = crc >> 8; |
90 | *skb_put(skb, 1) = crc & 0xFF; | 90 | *(u8 *)skb_put(skb, 1) = crc & 0xFF; |
91 | } | 91 | } |
92 | 92 | ||
93 | if (write_handshake_completion) { | 93 | if (write_handshake_completion) { |
@@ -172,8 +172,8 @@ static int send_acknowledge(struct nci_spi *nspi, u8 acknowledge) | |||
172 | hdr[3] = 0; | 172 | hdr[3] = 0; |
173 | 173 | ||
174 | crc = crc_ccitt(CRC_INIT, skb->data, skb->len); | 174 | crc = crc_ccitt(CRC_INIT, skb->data, skb->len); |
175 | *skb_put(skb, 1) = crc >> 8; | 175 | *(u8 *)skb_put(skb, 1) = crc >> 8; |
176 | *skb_put(skb, 1) = crc & 0xFF; | 176 | *(u8 *)skb_put(skb, 1) = crc & 0xFF; |
177 | 177 | ||
178 | ret = __nci_spi_send(nspi, skb, 0); | 178 | ret = __nci_spi_send(nspi, skb, 0); |
179 | 179 | ||
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index cfa7f352c1c3..442f8eadfc76 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c | |||
@@ -355,7 +355,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, | |||
355 | 355 | ||
356 | /* Eat byte after byte till full packet header is received */ | 356 | /* Eat byte after byte till full packet header is received */ |
357 | if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) { | 357 | if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) { |
358 | *skb_put(nu->rx_skb, 1) = *data++; | 358 | *(u8 *)skb_put(nu->rx_skb, 1) = *data++; |
359 | --count; | 359 | --count; |
360 | continue; | 360 | continue; |
361 | } | 361 | } |
diff --git a/net/psample/psample.c b/net/psample/psample.c index 8aa58a918783..3a6ad0f438dc 100644 --- a/net/psample/psample.c +++ b/net/psample/psample.c | |||
@@ -264,7 +264,7 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, | |||
264 | int nla_len = nla_total_size(data_len); | 264 | int nla_len = nla_total_size(data_len); |
265 | struct nlattr *nla; | 265 | struct nlattr *nla; |
266 | 266 | ||
267 | nla = (struct nlattr *)skb_put(nl_skb, nla_len); | 267 | nla = skb_put(nl_skb, nla_len); |
268 | nla->nla_type = PSAMPLE_ATTR_DATA; | 268 | nla->nla_type = PSAMPLE_ATTR_DATA; |
269 | nla->nla_len = nla_attr_size(data_len); | 269 | nla->nla_len = nla_attr_size(data_len); |
270 | 270 | ||
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index cff679167bdc..5586609afa27 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c | |||
@@ -259,7 +259,7 @@ static struct sk_buff *qrtr_alloc_ctrl_packet(u32 type, size_t pkt_len, | |||
259 | return NULL; | 259 | return NULL; |
260 | skb_reset_transport_header(skb); | 260 | skb_reset_transport_header(skb); |
261 | 261 | ||
262 | hdr = (struct qrtr_hdr *)skb_put(skb, QRTR_HDR_SIZE); | 262 | hdr = skb_put(skb, QRTR_HDR_SIZE); |
263 | hdr->version = cpu_to_le32(QRTR_PROTO_VER); | 263 | hdr->version = cpu_to_le32(QRTR_PROTO_VER); |
264 | hdr->type = cpu_to_le32(type); | 264 | hdr->type = cpu_to_le32(type); |
265 | hdr->src_node_id = cpu_to_le32(src_node); | 265 | hdr->src_node_id = cpu_to_le32(src_node); |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 034e916362cf..2c196b3e9cd3 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1389,7 +1389,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, | |||
1389 | goto nodata; | 1389 | goto nodata; |
1390 | 1390 | ||
1391 | /* Make room for the chunk header. */ | 1391 | /* Make room for the chunk header. */ |
1392 | chunk_hdr = (sctp_chunkhdr_t *)skb_put(skb, sizeof(sctp_chunkhdr_t)); | 1392 | chunk_hdr = skb_put(skb, sizeof(sctp_chunkhdr_t)); |
1393 | chunk_hdr->type = type; | 1393 | chunk_hdr->type = type; |
1394 | chunk_hdr->flags = flags; | 1394 | chunk_hdr->flags = flags; |
1395 | chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); | 1395 | chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index ec2b3e013c2f..e361f0b57fb6 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -167,8 +167,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
167 | goto fail; | 167 | goto fail; |
168 | 168 | ||
169 | skb = sctp_event2skb(event); | 169 | skb = sctp_event2skb(event); |
170 | sac = (struct sctp_assoc_change *) skb_put(skb, | 170 | sac = skb_put(skb, sizeof(struct sctp_assoc_change)); |
171 | sizeof(struct sctp_assoc_change)); | ||
172 | } | 171 | } |
173 | 172 | ||
174 | /* Socket Extensions for SCTP | 173 | /* Socket Extensions for SCTP |
@@ -270,8 +269,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( | |||
270 | goto fail; | 269 | goto fail; |
271 | 270 | ||
272 | skb = sctp_event2skb(event); | 271 | skb = sctp_event2skb(event); |
273 | spc = (struct sctp_paddr_change *) | 272 | spc = skb_put(skb, sizeof(struct sctp_paddr_change)); |
274 | skb_put(skb, sizeof(struct sctp_paddr_change)); | ||
275 | 273 | ||
276 | /* Sockets API Extensions for SCTP | 274 | /* Sockets API Extensions for SCTP |
277 | * Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE | 275 | * Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE |
@@ -549,8 +547,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( | |||
549 | goto fail; | 547 | goto fail; |
550 | 548 | ||
551 | skb = sctp_event2skb(event); | 549 | skb = sctp_event2skb(event); |
552 | sse = (struct sctp_shutdown_event *) | 550 | sse = skb_put(skb, sizeof(struct sctp_shutdown_event)); |
553 | skb_put(skb, sizeof(struct sctp_shutdown_event)); | ||
554 | 551 | ||
555 | /* Socket Extensions for SCTP | 552 | /* Socket Extensions for SCTP |
556 | * 5.3.1.5 SCTP_SHUTDOWN_EVENT | 553 | * 5.3.1.5 SCTP_SHUTDOWN_EVENT |
@@ -612,8 +609,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_adaptation_indication( | |||
612 | goto fail; | 609 | goto fail; |
613 | 610 | ||
614 | skb = sctp_event2skb(event); | 611 | skb = sctp_event2skb(event); |
615 | sai = (struct sctp_adaptation_event *) | 612 | sai = skb_put(skb, sizeof(struct sctp_adaptation_event)); |
616 | skb_put(skb, sizeof(struct sctp_adaptation_event)); | ||
617 | 613 | ||
618 | sai->sai_type = SCTP_ADAPTATION_INDICATION; | 614 | sai->sai_type = SCTP_ADAPTATION_INDICATION; |
619 | sai->sai_flags = 0; | 615 | sai->sai_flags = 0; |
@@ -751,8 +747,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi( | |||
751 | goto fail; | 747 | goto fail; |
752 | 748 | ||
753 | skb = sctp_event2skb(event); | 749 | skb = sctp_event2skb(event); |
754 | pd = (struct sctp_pdapi_event *) | 750 | pd = skb_put(skb, sizeof(struct sctp_pdapi_event)); |
755 | skb_put(skb, sizeof(struct sctp_pdapi_event)); | ||
756 | 751 | ||
757 | /* pdapi_type | 752 | /* pdapi_type |
758 | * It should be SCTP_PARTIAL_DELIVERY_EVENT | 753 | * It should be SCTP_PARTIAL_DELIVERY_EVENT |
@@ -803,8 +798,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey( | |||
803 | goto fail; | 798 | goto fail; |
804 | 799 | ||
805 | skb = sctp_event2skb(event); | 800 | skb = sctp_event2skb(event); |
806 | ak = (struct sctp_authkey_event *) | 801 | ak = skb_put(skb, sizeof(struct sctp_authkey_event)); |
807 | skb_put(skb, sizeof(struct sctp_authkey_event)); | ||
808 | 802 | ||
809 | ak->auth_type = SCTP_AUTHENTICATION_EVENT; | 803 | ak->auth_type = SCTP_AUTHENTICATION_EVENT; |
810 | ak->auth_flags = 0; | 804 | ak->auth_flags = 0; |
@@ -842,8 +836,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | |||
842 | return NULL; | 836 | return NULL; |
843 | 837 | ||
844 | skb = sctp_event2skb(event); | 838 | skb = sctp_event2skb(event); |
845 | sdry = (struct sctp_sender_dry_event *) | 839 | sdry = skb_put(skb, sizeof(struct sctp_sender_dry_event)); |
846 | skb_put(skb, sizeof(struct sctp_sender_dry_event)); | ||
847 | 840 | ||
848 | sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT; | 841 | sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT; |
849 | sdry->sender_dry_flags = 0; | 842 | sdry->sender_dry_flags = 0; |
@@ -869,7 +862,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( | |||
869 | return NULL; | 862 | return NULL; |
870 | 863 | ||
871 | skb = sctp_event2skb(event); | 864 | skb = sctp_event2skb(event); |
872 | sreset = (struct sctp_stream_reset_event *)skb_put(skb, length); | 865 | sreset = skb_put(skb, length); |
873 | 866 | ||
874 | sreset->strreset_type = SCTP_STREAM_RESET_EVENT; | 867 | sreset->strreset_type = SCTP_STREAM_RESET_EVENT; |
875 | sreset->strreset_flags = flags; | 868 | sreset->strreset_flags = flags; |
@@ -897,8 +890,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event( | |||
897 | return NULL; | 890 | return NULL; |
898 | 891 | ||
899 | skb = sctp_event2skb(event); | 892 | skb = sctp_event2skb(event); |
900 | areset = (struct sctp_assoc_reset_event *) | 893 | areset = skb_put(skb, sizeof(struct sctp_assoc_reset_event)); |
901 | skb_put(skb, sizeof(struct sctp_assoc_reset_event)); | ||
902 | 894 | ||
903 | areset->assocreset_type = SCTP_ASSOC_RESET_EVENT; | 895 | areset->assocreset_type = SCTP_ASSOC_RESET_EVENT; |
904 | areset->assocreset_flags = flags; | 896 | areset->assocreset_flags = flags; |
@@ -925,8 +917,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_change_event( | |||
925 | return NULL; | 917 | return NULL; |
926 | 918 | ||
927 | skb = sctp_event2skb(event); | 919 | skb = sctp_event2skb(event); |
928 | schange = (struct sctp_stream_change_event *) | 920 | schange = skb_put(skb, sizeof(struct sctp_stream_change_event)); |
929 | skb_put(skb, sizeof(struct sctp_stream_change_event)); | ||
930 | 921 | ||
931 | schange->strchange_type = SCTP_STREAM_CHANGE_EVENT; | 922 | schange->strchange_type = SCTP_STREAM_CHANGE_EVENT; |
932 | schange->strchange_flags = flags; | 923 | schange->strchange_flags = flags; |
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 24e2054bfbaf..7d6ee03f2762 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c | |||
@@ -99,7 +99,7 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) | |||
99 | if (!skb) | 99 | if (!skb) |
100 | return NULL; | 100 | return NULL; |
101 | 101 | ||
102 | hdr = (struct af_vsockmon_hdr *)skb_put(skb, sizeof(*hdr)); | 102 | hdr = skb_put(skb, sizeof(*hdr)); |
103 | 103 | ||
104 | /* pkt->hdr is little-endian so no need to byteswap here */ | 104 | /* pkt->hdr is little-endian so no need to byteswap here */ |
105 | hdr->src_cid = pkt->hdr.src_cid; | 105 | hdr->src_cid = pkt->hdr.src_cid; |