Skip to content

Commit

Permalink
networking: make skb_push & __skb_push return void pointers
Browse files Browse the repository at this point in the history
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 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_push, __skb_push, skb_push_rcsum };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    @@
    expression SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - fn(SKB, LEN)[0]
    + *(u8 *)fn(SKB, LEN)

Note that the last part there converts from push(...)[0] to the
more idiomatic *(u8 *)push(...).

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jmberg-intel authored and davem330 committed Jun 16, 2017
1 parent af72868 commit d58ff35
Show file tree
Hide file tree
Showing 126 changed files with 204 additions and 234 deletions.
2 changes: 1 addition & 1 deletion drivers/atm/solos-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
}
}

header = (void *)skb_push(skb, sizeof(*header));
header = skb_push(skb, sizeof(*header));

/* This does _not_ include the size of the header */
header->size = cpu_to_le16(pktlen);
Expand Down
2 changes: 1 addition & 1 deletion drivers/bluetooth/bpa10x.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return -ENOMEM;

/* Prepend skb with frame type */
*skb_push(skb, 1) = hci_skb_pkt_type(skb);
*(u8 *)skb_push(skb, 1) = hci_skb_pkt_type(skb);

switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT:
Expand Down
8 changes: 3 additions & 5 deletions drivers/firewire/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int fwnet_header_create(struct sk_buff *skb, struct net_device *net,
{
struct fwnet_header *h;

h = (struct fwnet_header *)skb_push(skb, sizeof(*h));
h = skb_push(skb, sizeof(*h));
put_unaligned_be16(type, &h->h_proto);

if (net->flags & (IFF_LOOPBACK | IFF_NOARP)) {
Expand Down Expand Up @@ -961,16 +961,14 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask)
tx_len = ptask->max_payload;
switch (fwnet_get_hdr_lf(&ptask->hdr)) {
case RFC2374_HDR_UNFRAG:
bufhdr = (struct rfc2734_header *)
skb_push(ptask->skb, RFC2374_UNFRAG_HDR_SIZE);
bufhdr = skb_push(ptask->skb, RFC2374_UNFRAG_HDR_SIZE);
put_unaligned_be32(ptask->hdr.w0, &bufhdr->w0);
break;

case RFC2374_HDR_FIRSTFRAG:
case RFC2374_HDR_INTFRAG:
case RFC2374_HDR_LASTFRAG:
bufhdr = (struct rfc2734_header *)
skb_push(ptask->skb, RFC2374_FRAG_HDR_SIZE);
bufhdr = skb_push(ptask->skb, RFC2374_FRAG_HDR_SIZE);
put_unaligned_be32(ptask->hdr.w0, &bufhdr->w0);
put_unaligned_be32(ptask->hdr.w1, &bufhdr->w1);
break;
Expand Down
6 changes: 3 additions & 3 deletions drivers/infiniband/hw/cxgb3/iwch_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb)
set_arp_failure_handler(skb, arp_failure_discard);
skb_reset_transport_header(skb);
len = skb->len;
req = (struct tx_data_wr *) skb_push(skb, sizeof(*req));
req = skb_push(skb, sizeof(*req));
req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL);
req->wr_lo = htonl(V_WR_TID(ep->hwtid));
req->len = htonl(len);
Expand Down Expand Up @@ -564,7 +564,7 @@ static int send_mpa_reject(struct iwch_ep *ep, const void *pdata, u8 plen)
skb->priority = CPL_PRIORITY_DATA;
set_arp_failure_handler(skb, arp_failure_discard);
skb_reset_transport_header(skb);
req = (struct tx_data_wr *) skb_push(skb, sizeof(*req));
req = skb_push(skb, sizeof(*req));
req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL);
req->wr_lo = htonl(V_WR_TID(ep->hwtid));
req->len = htonl(mpalen);
Expand Down Expand Up @@ -615,7 +615,7 @@ static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen)
set_arp_failure_handler(skb, arp_failure_discard);
skb_reset_transport_header(skb);
len = skb->len;
req = (struct tx_data_wr *) skb_push(skb, sizeof(*req));
req = skb_push(skb, sizeof(*req));
req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL);
req->wr_lo = htonl(V_WR_TID(ep->hwtid));
req->len = htonl(len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/cxgb4/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3751,7 +3751,7 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos)
tcp_clear_options(&tmp_opt);
tcp_parse_options(&init_net, skb, &tmp_opt, 0, NULL);

req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req));
req = __skb_push(skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->l2info = cpu_to_be16(SYN_INTF_V(intf) |
SYN_MAC_IDX_V(RX_MACIDX_G(
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ static void push_pseudo_header(struct sk_buff *skb, const char *daddr)
{
struct ipoib_pseudo_header *phdr;

phdr = (struct ipoib_pseudo_header *)skb_push(skb, sizeof(*phdr));
phdr = skb_push(skb, sizeof(*phdr));
memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);
}

Expand Down Expand Up @@ -1129,7 +1129,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
{
struct ipoib_header *header;

header = (struct ipoib_header *) skb_push(skb, sizeof *header);
header = skb_push(skb, sizeof *header);

header->proto = htons(type);
header->reserved = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void opa_vnic_encap_skb(struct opa_vnic_adapter *adapter, struct sk_buff *skb)
sc = opa_vnic_get_sc(info, skb);
l4_hdr = info->vesw.vesw_id;

mdata = (struct opa_vnic_skb_mdata *)skb_push(skb, sizeof(*mdata));
mdata = skb_push(skb, sizeof(*mdata));
mdata->vl = opa_vnic_get_vl(adapter, skb);
mdata->entropy = entropy;
mdata->flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static u16 opa_vnic_select_queue(struct net_device *netdev, struct sk_buff *skb,
int rc;

/* pass entropy and vl as metadata in skb */
mdata = (struct opa_vnic_skb_mdata *)skb_push(skb, sizeof(*mdata));
mdata = skb_push(skb, sizeof(*mdata));
mdata->entropy = opa_vnic_calc_entropy(adapter, skb);
mdata->vl = opa_vnic_get_vl(adapter, skb);
rc = adapter->rn_ops->ndo_select_queue(netdev, skb,
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/i4l/isdn_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
/* check if we should pass this packet
* the filter instructions are constructed assuming
* a four-byte PPP header on each packet */
*skb_push(skb, 4) = 1; /* indicate outbound */
*(u8 *)skb_push(skb, 4) = 1; /* indicate outbound */

{
__be16 *p = (__be16 *)skb->data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arcnet/arc-rawmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
struct archdr *pkt = skb_push(skb, hdr_size);

/* Set the source hardware address.
*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arcnet/capmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int build_header(struct sk_buff *skb,
uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
struct archdr *pkt = skb_push(skb, hdr_size);

arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n",
*((int *)&pkt->soft.cap.cookie[0]));
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arcnet/rfc1051.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
struct archdr *pkt = skb_push(skb, hdr_size);
struct arc_rfc1051 *soft = &pkt->soft.rfc1051;

/* set the protocol ID according to RFC1051 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/arcnet/rfc1201.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
{
struct arcnet_local *lp = netdev_priv(dev);
int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
struct archdr *pkt = skb_push(skb, hdr_size);
struct arc_rfc1201 *soft = &pkt->soft.rfc1201;

/* set the protocol ID according to RFC1201 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bcmsysport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ static struct sk_buff *bcm_sysport_insert_tsb(struct sk_buff *skb,
skb = nskb;
}

tsb = (struct bcm_tsb *)skb_push(skb, sizeof(*tsb));
tsb = skb_push(skb, sizeof(*tsb));
/* Zero-out TSB by default */
memset(tsb, 0, sizeof(*tsb));

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/chelsio/cxgb/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
eth_type = skb_network_offset(skb) == ETH_HLEN ?
CPL_ETH_II : CPL_ETH_II_VLAN;

hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr));
hdr = skb_push(skb, sizeof(*hdr));
hdr->opcode = CPL_TX_PKT_LSO;
hdr->ip_csum_dis = hdr->l4_csum_dis = 0;
hdr->ip_hdr_words = ip_hdr(skb)->ihl;
Expand Down Expand Up @@ -1849,7 +1849,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
}

cpl = (struct cpl_tx_pkt *)__skb_push(skb, sizeof(*cpl));
cpl = __skb_push(skb, sizeof(*cpl));
cpl->opcode = CPL_TX_PKT;
cpl->ip_csum_dis = 1; /* SW calculates IP csum */
cpl->l4_csum_dis = skb->ip_summed == CHECKSUM_PARTIAL ? 0 : 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ static int gfar_enet_open(struct net_device *dev)

static inline struct txfcb *gfar_add_fcb(struct sk_buff *skb)
{
struct txfcb *fcb = (struct txfcb *)skb_push(skb, GMAC_FCB_LEN);
struct txfcb *fcb = skb_push(skb, GMAC_FCB_LEN);

memset(fcb, 0, GMAC_FCB_LEN);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv)
skb_reserve(skb, NET_IP_ALIGN);

/* Reserve for ethernet and IP header */
ethh = (struct ethhdr *)skb_push(skb, ETH_HLEN);
ethh = skb_push(skb, ETH_HLEN);
skb_reset_mac_header(skb);

skb_set_network_header(skb, skb->len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/sun/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -6667,7 +6667,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
headroom = align + sizeof(struct tx_pkt_hdr);

ehdr = (struct ethhdr *) skb->data;
tp = (struct tx_pkt_hdr *) skb_push(skb, headroom);
tp = skb_push(skb, headroom);

len = skb->len - sizeof(struct tx_pkt_hdr);
tp->flags = cpu_to_le64(niu_compute_tx_flags(skb, ehdr, align, len));
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/toshiba/ps3_gelic_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ static struct sk_buff *gelic_put_vlan_tag(struct sk_buff *skb,
return NULL;
dev_kfree_skb_any(sk_tmp);
}
veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
veth = skb_push(skb, VLAN_HLEN);

/* Move the mac addresses to the top of buffer */
memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/geneve.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,7 @@ static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb,
if (err)
goto free_dst;

gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) +
info->options_len);
gnvh = __skb_push(skb, sizeof(*gnvh) + info->options_len);
geneve_build_header(gnvh, info);
skb_set_inner_protocol(skb, htons(ETH_P_TEB));
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/gtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static inline void gtp0_push_header(struct sk_buff *skb, struct pdp_ctx *pctx)
int payload_len = skb->len;
struct gtp0_header *gtp0;

gtp0 = (struct gtp0_header *) skb_push(skb, sizeof(*gtp0));
gtp0 = skb_push(skb, sizeof(*gtp0));

gtp0->flags = 0x1e; /* v0, GTP-non-prime. */
gtp0->type = GTP_TPDU;
Expand All @@ -415,7 +415,7 @@ static inline void gtp1_push_header(struct sk_buff *skb, struct pdp_ctx *pctx)
int payload_len = skb->len;
struct gtp1_header *gtp1;

gtp1 = (struct gtp1_header *) skb_push(skb, sizeof(*gtp1));
gtp1 = skb_push(skb, sizeof(*gtp1));

/* Bits 8 7 6 5 4 3 2 1
* +--+--+--+--+--+--+--+--+
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hippi/rrunner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
skb = new_skb;
}

ifield = (u32 *)skb_push(skb, 8);
ifield = skb_push(skb, 8);

ifield[0] = 0;
ifield[1] = hcb->ifield;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
unprotected_len = skb->len;
eth = eth_hdr(skb);
sci_present = send_sci(secy);
hh = (struct macsec_eth_header *)skb_push(skb, macsec_extra_len(sci_present));
hh = skb_push(skb, macsec_extra_len(sci_present));
memmove(hh, eth, 2 * ETH_ALEN);

pn = tx_sa_update_pn(tx_sa, secy);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ppp/ppp_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ process_input_packet(struct asyncppp *ap)
proto = p[0];
if (proto & 1) {
/* protocol is compressed */
skb_push(skb, 1)[0] = 0;
*(u8 *)skb_push(skb, 1) = 0;
} else {
if (skb->len < 2)
goto err;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ppp/ppp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
/* check if we should pass this packet */
/* the filter instructions are constructed assuming
a four-byte PPP header on each packet */
*skb_push(skb, 2) = 1;
*(u8 *)skb_push(skb, 2) = 1;
if (ppp->pass_filter &&
BPF_PROG_RUN(ppp->pass_filter, skb) == 0) {
if (ppp->debug & 1)
Expand Down Expand Up @@ -2133,7 +2133,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
if (skb_unclone(skb, GFP_ATOMIC))
goto err;

*skb_push(skb, 2) = 0;
*(u8 *)skb_push(skb, 2) = 0;
if (ppp->pass_filter &&
BPF_PROG_RUN(ppp->pass_filter, skb) == 0) {
if (ppp->debug & 1)
Expand Down Expand Up @@ -2267,7 +2267,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
* Do protocol ID decompression on the first fragment of each packet.
*/
if ((PPP_MP_CB(skb)->BEbits & B) && (skb->data[0] & 1))
*skb_push(skb, 1) = 0;
*(u8 *)skb_push(skb, 1) = 0;

/*
* Expand sequence number to 32 bits, making it as close
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ppp/ppp_synctty.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
/* decompress protocol field if compressed */
if (p[0] & 1) {
/* protocol is compressed */
skb_push(skb, 1)[0] = 0;
*(u8 *)skb_push(skb, 1) = 0;
} else if (skb->len < 2)
goto err;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ppp/pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)

if ((*skb->data) & 1) {
/* protocol is compressed */
skb_push(skb, 1)[0] = 0;
*(u8 *)skb_push(skb, 1) = 0;
}

skb->ip_summed = CHECKSUM_NONE;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/gl620a.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
}

// attach the packet count to the header
packet_count = (__le32 *) skb_push(skb, (4 + 4*1));
packet_count = skb_push(skb, (4 + 4 * 1));
packet_len = packet_count + 1;

*packet_count = cpu_to_le32(1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/int51x1.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev,
pack_len += need_tail;
pack_len &= 0x07ff;

len = (__le16 *) __skb_push(skb, INT51X1_HEADER_SIZE);
len = __skb_push(skb, INT51X1_HEADER_SIZE);
*len = cpu_to_le16(pack_len);

if(need_tail)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/kaweth.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}

private_header = (__le16 *)__skb_push(skb, 2);
private_header = __skb_push(skb, 2);
*private_header = cpu_to_le16(skb->len-2);
kaweth->tx_skb = skb;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/lg-vl600.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static struct sk_buff *vl600_tx_fixup(struct usbnet *dev,
memset(&packet->dummy, 0, sizeof(packet->dummy));
packet->len = cpu_to_le32(orig_len);

frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame));
frame = skb_push(skb, sizeof(*frame));
memset(frame, 0, sizeof(*frame));
frame->len = cpu_to_le32(full_len);
frame->serial = cpu_to_le32(serial++);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/net1080.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)

encapsulate:
/* header first */
header = (struct nc_header *) skb_push(skb, sizeof *header);
header = skb_push(skb, sizeof *header);
header->hdr_len = cpu_to_le16(sizeof (*header));
header->packet_len = cpu_to_le16(len);
header->packet_id = cpu_to_le16((u16)dev->xid++);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/qmi_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static netdev_tx_t qmimux_start_xmit(struct sk_buff *skb, struct net_device *dev
unsigned int len = skb->len;
struct qmimux_hdr *hdr;

hdr = (struct qmimux_hdr *)skb_push(skb, sizeof(struct qmimux_hdr));
hdr = skb_push(skb, sizeof(struct qmimux_hdr));
hdr->pad = 0;
hdr->mux_id = priv->mux_id;
hdr->pkt_len = cpu_to_be16(len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/rndis_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
* packets; Linux minimizes wasted bandwidth through tx queues.
*/
fill:
hdr = (void *) __skb_push(skb, sizeof *hdr);
hdr = __skb_push(skb, sizeof *hdr);
memset(hdr, 0, sizeof *hdr);
hdr->msg_type = cpu_to_le32(RNDIS_MSG_PACKET);
hdr->msg_len = cpu_to_le32(skb->len);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static int vrf_finish_direct(struct net *net, struct sock *sk,

if (!list_empty(&vrf_dev->ptype_all) &&
likely(skb_headroom(skb) >= ETH_HLEN)) {
struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
struct ethhdr *eth = skb_push(skb, ETH_HLEN);

ether_addr_copy(eth->h_source, vrf_dev->dev_addr);
eth_zero_addr(eth->h_dest);
Expand Down
Loading

0 comments on commit d58ff35

Please sign in to comment.