Merge branch 'net-more-skb_put-work'

yuan linyu says:

====================
net: more skb_put_[data:zero] related work

yuan linyu (3):
  net: introduce __skb_put_[zero, data, u8]
  net: replace more place to skb_put_[data:zero]
  net: manual clean code which call skb_put_[data:zero]
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2017-06-20 13:30:16 -04:00
commit c0ca9e7201
65 changed files with 166 additions and 218 deletions

View File

@ -604,8 +604,7 @@ static struct sk_buff
if (!skb) if (!skb)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
skb_reserve(skb, sizeof(struct sge_opaque_hdr)); skb_reserve(skb, sizeof(struct sge_opaque_hdr));
chcr_req = __skb_put(skb, transhdr_len); chcr_req = __skb_put_zero(skb, transhdr_len);
memset(chcr_req, 0, transhdr_len);
chcr_req->sec_cpl.op_ivinsrtofst = chcr_req->sec_cpl.op_ivinsrtofst =
FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 1); FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 1);
@ -881,8 +880,7 @@ static struct sk_buff *create_hash_wr(struct ahash_request *req,
return skb; return skb;
skb_reserve(skb, sizeof(struct sge_opaque_hdr)); skb_reserve(skb, sizeof(struct sge_opaque_hdr));
chcr_req = __skb_put(skb, transhdr_len); chcr_req = __skb_put_zero(skb, transhdr_len);
memset(chcr_req, 0, transhdr_len);
chcr_req->sec_cpl.op_ivinsrtofst = chcr_req->sec_cpl.op_ivinsrtofst =
FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 0); FILL_SEC_CPL_OP_IVINSR(ctx->dev->rx_channel_id, 2, 0);
@ -1447,8 +1445,7 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req,
skb_reserve(skb, sizeof(struct sge_opaque_hdr)); skb_reserve(skb, sizeof(struct sge_opaque_hdr));
/* Write WR */ /* Write WR */
chcr_req = __skb_put(skb, transhdr_len); chcr_req = __skb_put_zero(skb, transhdr_len);
memset(chcr_req, 0, transhdr_len);
stop_offset = (op_type == CHCR_ENCRYPT_OP) ? 0 : authsize; stop_offset = (op_type == CHCR_ENCRYPT_OP) ? 0 : authsize;
@ -1779,8 +1776,7 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req,
skb_reserve(skb, sizeof(struct sge_opaque_hdr)); skb_reserve(skb, sizeof(struct sge_opaque_hdr));
chcr_req = __skb_put(skb, transhdr_len); chcr_req = __skb_put_zero(skb, transhdr_len);
memset(chcr_req, 0, transhdr_len);
fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, op_type, ctx); fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, op_type, ctx);
@ -1892,8 +1888,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req,
/* NIC driver is going to write the sge hdr. */ /* NIC driver is going to write the sge hdr. */
skb_reserve(skb, sizeof(struct sge_opaque_hdr)); skb_reserve(skb, sizeof(struct sge_opaque_hdr));
chcr_req = __skb_put(skb, transhdr_len); chcr_req = __skb_put_zero(skb, transhdr_len);
memset(chcr_req, 0, transhdr_len);
if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106)
req->assoclen -= 8; req->assoclen -= 8;

View File

@ -1900,8 +1900,7 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
int win; int win;
skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
req = __skb_put(skb, sizeof(*req)); req = __skb_put_zero(skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
req->le.filter = cpu_to_be32(cxgb4_select_ntuple( req->le.filter = cpu_to_be32(cxgb4_select_ntuple(
@ -3803,8 +3802,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL);
if (!req_skb) if (!req_skb)
return; return;
req = __skb_put(req_skb, sizeof(*req)); req = __skb_put_zero(req_skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F);
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F); req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F);

View File

@ -44,8 +44,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
wr_len = sizeof *res_wr + sizeof *res; wr_len = sizeof *res_wr + sizeof *res;
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
res_wr = __skb_put(skb, wr_len); res_wr = __skb_put_zero(skb, wr_len);
memset(res_wr, 0, wr_len);
res_wr->op_nres = cpu_to_be32( res_wr->op_nres = cpu_to_be32(
FW_WR_OP_V(FW_RI_RES_WR) | FW_WR_OP_V(FW_RI_RES_WR) |
FW_RI_RES_WR_NRES_V(1) | FW_RI_RES_WR_NRES_V(1) |
@ -114,8 +113,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
} }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
res_wr = __skb_put(skb, wr_len); res_wr = __skb_put_zero(skb, wr_len);
memset(res_wr, 0, wr_len);
res_wr->op_nres = cpu_to_be32( res_wr->op_nres = cpu_to_be32(
FW_WR_OP_V(FW_RI_RES_WR) | FW_WR_OP_V(FW_RI_RES_WR) |
FW_RI_RES_WR_NRES_V(1) | FW_RI_RES_WR_NRES_V(1) |

View File

@ -81,8 +81,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr,
} }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
req = __skb_put(skb, wr_len); req = __skb_put_zero(skb, wr_len);
memset(req, 0, wr_len);
INIT_ULPTX_WR(req, wr_len, 0, 0); INIT_ULPTX_WR(req, wr_len, 0, 0);
req->wr.wr_hi = cpu_to_be32(FW_WR_OP_V(FW_ULPTX_WR) | req->wr.wr_hi = cpu_to_be32(FW_WR_OP_V(FW_ULPTX_WR) |
(wait ? FW_WR_COMPL_F : 0)); (wait ? FW_WR_COMPL_F : 0));
@ -142,8 +141,7 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len,
} }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
req = __skb_put(skb, wr_len); req = __skb_put_zero(skb, wr_len);
memset(req, 0, wr_len);
INIT_ULPTX_WR(req, wr_len, 0, 0); INIT_ULPTX_WR(req, wr_len, 0, 0);
if (i == (num_wqe-1)) { if (i == (num_wqe-1)) {

View File

@ -293,8 +293,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
} }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0); set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
res_wr = __skb_put(skb, wr_len); res_wr = __skb_put_zero(skb, wr_len);
memset(res_wr, 0, wr_len);
res_wr->op_nres = cpu_to_be32( res_wr->op_nres = cpu_to_be32(
FW_WR_OP_V(FW_RI_RES_WR) | FW_WR_OP_V(FW_RI_RES_WR) |
FW_RI_RES_WR_NRES_V(2) | FW_RI_RES_WR_NRES_V(2) |

View File

@ -264,7 +264,7 @@ byte_stuff:
/* skip remainder of packet */ /* skip remainder of packet */
bcs->rx_skb = skb = NULL; bcs->rx_skb = skb = NULL;
} else { } else {
*(u8 *)__skb_put(skb, 1) = c; __skb_put_u8(skb, c);
fcs = crc_ccitt_byte(fcs, c); fcs = crc_ccitt_byte(fcs, c);
} }
} }
@ -315,7 +315,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf)
/* regular data byte: append to current skb */ /* regular data byte: append to current skb */
inputstate |= INS_have_data; inputstate |= INS_have_data;
*(u8 *)__skb_put(skb, 1) = bitrev8(c); __skb_put_u8(skb, bitrev8(c));
} }
/* pass data up */ /* pass data up */

View File

@ -511,7 +511,7 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
bcs->rx_skb = NULL; bcs->rx_skb = NULL;
return; return;
} }
*(u8 *)__skb_put(bcs->rx_skb, 1) = c; __skb_put_u8(bcs->rx_skb, c);
} }
/* hdlc_flush /* hdlc_flush

View File

@ -173,8 +173,8 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
} }
skb_put_data(skb, &len, sizeof(__u16)); skb_put_data(skb, &len, sizeof(__u16));
skb_put_data(skb, &appl, sizeof(__u16)); skb_put_data(skb, &appl, sizeof(__u16));
memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); skb_put_data(skb, &_command, sizeof(__u8));
memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); skb_put_data(skb, &_subcommand, sizeof(__u8));
skb_put_data(skb, &MessageNumber, sizeof(__u16)); skb_put_data(skb, &MessageNumber, sizeof(__u16));
skb_put_data(skb, &MessageBufferSize, sizeof(__u16)); skb_put_data(skb, &MessageBufferSize, sizeof(__u16));
skb_put_data(skb, &(rp->level3cnt), sizeof(__u16)); skb_put_data(skb, &(rp->level3cnt), sizeof(__u16));
@ -281,8 +281,8 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl)
} }
skb_put_data(skb, &len, sizeof(__u16)); skb_put_data(skb, &len, sizeof(__u16));
skb_put_data(skb, &appl, sizeof(__u16)); skb_put_data(skb, &appl, sizeof(__u16));
memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command)); skb_put_data(skb, &_command, sizeof(__u8));
memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand)); skb_put_data(skb, &_subcommand, sizeof(__u8));
skb_put_data(skb, &MessageNumber, sizeof(__u16)); skb_put_data(skb, &MessageNumber, sizeof(__u16));
hycapi_send_message(ctrl, skb); hycapi_send_message(ctrl, skb);
hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1)); hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1));

View File

@ -472,7 +472,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb
accm |= ((ent) << bitno); \ accm |= ((ent) << bitno); \
do { \ do { \
if (skb_out && skb_tailroom(skb_out) > 0) \ if (skb_out && skb_tailroom(skb_out) > 0) \
*(u8 *)skb_put(skb_out, 1) = (u8)(accm >> 24); \ skb_put(skb_out, (u8)(accm >> 24)); \
accm <<= 8; \ accm <<= 8; \
bitno += 8; \ bitno += 8; \
} while (bitno <= 24); \ } while (bitno <= 24); \

View File

@ -2258,7 +2258,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
/* Now stuff remaining bytes */ /* Now stuff remaining bytes */
if (len) { if (len) {
p = skb_put_data(skb, data, len); skb_put_data(skb, data, len);
} }
/* skb is now ready for xmit */ /* skb is now ready for xmit */

View File

@ -925,7 +925,6 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
struct learning_pkt pkt; struct learning_pkt pkt;
struct sk_buff *skb; struct sk_buff *skb;
int size = sizeof(struct learning_pkt); int size = sizeof(struct learning_pkt);
char *data;
memset(&pkt, 0, size); memset(&pkt, 0, size);
ether_addr_copy(pkt.mac_dst, mac_addr); ether_addr_copy(pkt.mac_dst, mac_addr);
@ -936,7 +935,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
if (!skb) if (!skb)
return; return;
data = skb_put_data(skb, &pkt, size); skb_put_data(skb, &pkt, size);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->network_header = skb->mac_header + ETH_HLEN; skb->network_header = skb->mac_header + ETH_HLEN;

View File

@ -426,7 +426,6 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
/* Check for embedded CAIF frame. */ /* Check for embedded CAIF frame. */
if (desc->offset) { if (desc->offset) {
struct sk_buff *skb; struct sk_buff *skb;
u8 *dst = NULL;
int len = 0; int len = 0;
pfrm = ((u8 *)desc) + desc->offset; pfrm = ((u8 *)desc) + desc->offset;
@ -454,7 +453,7 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
} }
caif_assert(skb != NULL); caif_assert(skb != NULL);
dst = skb_put_data(skb, pfrm, len); skb_put_data(skb, pfrm, len);
skb->protocol = htons(ETH_P_CAIF); skb->protocol = htons(ETH_P_CAIF);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
@ -555,7 +554,6 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
/* Parse payload. */ /* Parse payload. */
while (nfrms < CFHSI_MAX_PKTS && *plen) { while (nfrms < CFHSI_MAX_PKTS && *plen) {
struct sk_buff *skb; struct sk_buff *skb;
u8 *dst = NULL;
u8 *pcffrm = NULL; u8 *pcffrm = NULL;
int len; int len;
@ -584,7 +582,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
} }
caif_assert(skb != NULL); caif_assert(skb != NULL);
dst = skb_put_data(skb, pcffrm, len); skb_put_data(skb, pcffrm, len);
skb->protocol = htons(ETH_P_CAIF); skb->protocol = htons(ETH_P_CAIF);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);

View File

@ -171,7 +171,6 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data,
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct ser_device *ser; struct ser_device *ser;
int ret; int ret;
u8 *p;
ser = tty->disc_data; ser = tty->disc_data;
@ -198,7 +197,7 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data,
skb = netdev_alloc_skb(ser->dev, count+1); skb = netdev_alloc_skb(ser->dev, count+1);
if (skb == NULL) if (skb == NULL)
return; return;
p = skb_put_data(skb, data, count); skb_put_data(skb, data, count);
skb->protocol = htons(ETH_P_CAIF); skb->protocol = htons(ETH_P_CAIF);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);

View File

@ -526,7 +526,6 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
int spad = 0; int spad = 0;
int epad = 0; int epad = 0;
u8 *dst = NULL;
int pkt_len = 0; int pkt_len = 0;
/* /*
@ -548,7 +547,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len)
skb = netdev_alloc_skb(cfspi->ndev, pkt_len + 1); skb = netdev_alloc_skb(cfspi->ndev, pkt_len + 1);
caif_assert(skb != NULL); caif_assert(skb != NULL);
dst = skb_put_data(skb, src, pkt_len); skb_put_data(skb, src, pkt_len);
src += pkt_len; src += pkt_len;
skb->protocol = htons(ETH_P_CAIF); skb->protocol = htons(ETH_P_CAIF);

View File

@ -471,8 +471,7 @@ static int init_tp_parity(struct adapter *adap)
if (!skb) if (!skb)
goto alloc_skb_fail; goto alloc_skb_fail;
req = __skb_put(skb, sizeof(*req)); req = __skb_put_zero(skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i));
req->mtu_idx = NMTUS - 1; req->mtu_idx = NMTUS - 1;
@ -495,8 +494,7 @@ static int init_tp_parity(struct adapter *adap)
if (!skb) if (!skb)
goto alloc_skb_fail; goto alloc_skb_fail;
req = __skb_put(skb, sizeof(*req)); req = __skb_put_zero(skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i));
req->params = htonl(V_L2T_W_IDX(i)); req->params = htonl(V_L2T_W_IDX(i));
@ -518,8 +516,7 @@ static int init_tp_parity(struct adapter *adap)
if (!skb) if (!skb)
goto alloc_skb_fail; goto alloc_skb_fail;
req = __skb_put(skb, sizeof(*req)); req = __skb_put_zero(skb, sizeof(*req));
memset(req, 0, sizeof(*req));
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i));
req->l2t_idx = htonl(V_L2T_W_IDX(i)); req->l2t_idx = htonl(V_L2T_W_IDX(i));
@ -538,8 +535,7 @@ static int init_tp_parity(struct adapter *adap)
if (!skb) if (!skb)
goto alloc_skb_fail; goto alloc_skb_fail;
greq = __skb_put(skb, sizeof(*greq)); greq = __skb_put_zero(skb, sizeof(*greq));
memset(greq, 0, sizeof(*greq));
greq->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); greq->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0)); OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0));
greq->mask = cpu_to_be64(1); greq->mask = cpu_to_be64(1);

View File

@ -2282,7 +2282,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
if (!skb) if (!skb)
goto no_mem; goto no_mem;
memcpy(__skb_put(skb, AN_PKT_SIZE), r, AN_PKT_SIZE); __skb_put_data(skb, r, AN_PKT_SIZE);
skb->data[0] = CPL_ASYNC_NOTIF; skb->data[0] = CPL_ASYNC_NOTIF;
rss_hi = htonl(CPL_ASYNC_NOTIF << 24); rss_hi = htonl(CPL_ASYNC_NOTIF << 24);
q->async_notif++; q->async_notif++;

View File

@ -231,8 +231,7 @@ int set_filter_wr(struct adapter *adapter, int fidx)
} }
} }
fwr = __skb_put(skb, sizeof(*fwr)); fwr = __skb_put_zero(skb, sizeof(*fwr));
memset(fwr, 0, sizeof(*fwr));
/* It would be nice to put most of the following in t4_hw.c but most /* It would be nice to put most of the following in t4_hw.c but most
* of the work is translating the cxgbtool ch_filter_specification * of the work is translating the cxgbtool ch_filter_specification

View File

@ -919,7 +919,6 @@ static int __lpc_handle_recv(struct net_device *ndev, int budget)
struct sk_buff *skb; struct sk_buff *skb;
u32 rxconsidx, len, ethst; u32 rxconsidx, len, ethst;
struct rx_status_t *prxstat; struct rx_status_t *prxstat;
u8 *prdbuf;
int rx_done = 0; int rx_done = 0;
/* Get the current RX buffer indexes */ /* Get the current RX buffer indexes */
@ -960,9 +959,9 @@ static int __lpc_handle_recv(struct net_device *ndev, int budget)
ndev->stats.rx_dropped++; ndev->stats.rx_dropped++;
} else { } else {
/* Copy packet from buffer */ /* Copy packet from buffer */
prdbuf = skb_put_data(skb, skb_put_data(skb,
pldat->rx_buff_v + rxconsidx * ENET_MAXF_SIZE, pldat->rx_buff_v + rxconsidx * ENET_MAXF_SIZE,
len); len);
/* Pass to upper layer */ /* Pass to upper layer */
skb->protocol = eth_type_trans(skb, ndev); skb->protocol = eth_type_trans(skb, ndev);

View File

@ -1495,8 +1495,8 @@ static int hamachi_rx(struct net_device *dev)
hmp->rx_skbuff[entry]->data, pkt_len); hmp->rx_skbuff[entry]->data, pkt_len);
skb_put(skb, pkt_len); skb_put(skb, pkt_len);
#else #else
memcpy(skb_put(skb, pkt_len), hmp->rx_ring_dma skb_put_data(skb, hmp->rx_ring_dma
+ entry*sizeof(*desc), pkt_len); + entry*sizeof(*desc), pkt_len);
#endif #endif
pci_dma_sync_single_for_device(hmp->pci_dev, pci_dma_sync_single_for_device(hmp->pci_dev,
leXX_to_cpu(hmp->rx_ring[entry].addr), leXX_to_cpu(hmp->rx_ring[entry].addr),

View File

@ -697,7 +697,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
goto err; goto err;
} }
p = skb_put_data(skb, buf, count); skb_put_data(skb, buf, count);
/* strip address/control field if present */ /* strip address/control field if present */
p = skb->data; p = skb->data;

View File

@ -113,7 +113,6 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb,
while (offset + sizeof(u16) <= skb->len) { while (offset + sizeof(u16) <= skb->len) {
u16 copy_length; u16 copy_length;
unsigned char *data;
if (!rx->remaining) { if (!rx->remaining) {
if (skb->len - offset == sizeof(u16)) { if (skb->len - offset == sizeof(u16)) {
@ -167,8 +166,8 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb,
} }
if (rx->ax_skb) { if (rx->ax_skb) {
data = skb_put_data(rx->ax_skb, skb->data + offset, skb_put_data(rx->ax_skb, skb->data + offset,
copy_length); copy_length);
if (!rx->remaining) if (!rx->remaining)
usbnet_skb_return(dev, rx->ax_skb); usbnet_skb_return(dev, rx->ax_skb);
} }

View File

@ -1069,7 +1069,7 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_
/* push a new empty NDP */ /* push a new empty NDP */
if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END))
ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); ndp16 = skb_put_zero(skb, ctx->max_ndp_size);
else else
ndp16 = ctx->delayed_ndp16; ndp16 = ctx->delayed_ndp16;
@ -1120,7 +1120,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
goto exit_no_skb; goto exit_no_skb;
} }
/* fill out the initial 16-bit NTB header */ /* fill out the initial 16-bit NTB header */
nth16 = (struct usb_cdc_ncm_nth16 *)memset(skb_put(skb_out, sizeof(struct usb_cdc_ncm_nth16)), 0, sizeof(struct usb_cdc_ncm_nth16)); nth16 = skb_put_zero(skb_out, sizeof(struct usb_cdc_ncm_nth16));
nth16->dwSignature = cpu_to_le32(USB_CDC_NCM_NTH16_SIGN); nth16->dwSignature = cpu_to_le32(USB_CDC_NCM_NTH16_SIGN);
nth16->wHeaderLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_nth16)); nth16->wHeaderLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_nth16));
nth16->wSequence = cpu_to_le16(ctx->tx_seq++); nth16->wSequence = cpu_to_le16(ctx->tx_seq++);

View File

@ -861,7 +861,6 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
unsigned short temp_bytes; unsigned short temp_bytes;
unsigned short buffer_offset = 0; unsigned short buffer_offset = 0;
unsigned short frame_len; unsigned short frame_len;
unsigned char *tmp_rx_buf;
/* log if needed */ /* log if needed */
hso_dbg(0x1, "Rx %d bytes\n", count); hso_dbg(0x1, "Rx %d bytes\n", count);
@ -911,9 +910,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
/* Copy what we got so far. make room for iphdr /* Copy what we got so far. make room for iphdr
* after tail. */ * after tail. */
tmp_rx_buf = skb_put_data(odev->skb_rx_buf, skb_put_data(odev->skb_rx_buf,
(char *)&(odev->rx_ip_hdr), (char *)&(odev->rx_ip_hdr),
sizeof(struct iphdr)); sizeof(struct iphdr));
/* ETH_HLEN */ /* ETH_HLEN */
odev->rx_buf_size = sizeof(struct iphdr); odev->rx_buf_size = sizeof(struct iphdr);
@ -932,9 +931,9 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
/* Copy the rest of the bytes that are left in the /* Copy the rest of the bytes that are left in the
* buffer into the waiting sk_buf. */ * buffer into the waiting sk_buf. */
/* Make room for temp_bytes after tail. */ /* Make room for temp_bytes after tail. */
tmp_rx_buf = skb_put_data(odev->skb_rx_buf, skb_put_data(odev->skb_rx_buf,
ip_pkt + buffer_offset, ip_pkt + buffer_offset,
temp_bytes); temp_bytes);
odev->rx_buf_missing -= temp_bytes; odev->rx_buf_missing -= temp_bytes;
count -= temp_bytes; count -= temp_bytes;

View File

@ -110,7 +110,7 @@ static struct sk_buff *int51x1_tx_fixup(struct usbnet *dev,
*len = cpu_to_le16(pack_len); *len = cpu_to_le16(pack_len);
if(need_tail) if(need_tail)
memset(__skb_put(skb, need_tail), 0, need_tail); __skb_put_zero(skb, need_tail);
return skb; return skb;
} }

View File

@ -298,7 +298,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
u16 headroom = sizeof(struct htc_frame_hdr) + u16 headroom = sizeof(struct htc_frame_hdr) +
sizeof(struct wmi_cmd_hdr); sizeof(struct wmi_cmd_hdr);
struct sk_buff *skb; struct sk_buff *skb;
u8 *data;
unsigned long time_left; unsigned long time_left;
int ret = 0; int ret = 0;
@ -312,7 +311,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
skb_reserve(skb, headroom); skb_reserve(skb, headroom);
if (cmd_len != 0 && cmd_buf != NULL) { if (cmd_len != 0 && cmd_buf != NULL) {
data = skb_put_data(skb, cmd_buf, cmd_len); skb_put_data(skb, cmd_buf, cmd_len);
} }
mutex_lock(&wmi->op_mutex); mutex_lock(&wmi->op_mutex);

View File

@ -239,7 +239,6 @@ static int if_sdio_handle_data(struct if_sdio_card *card,
{ {
int ret; int ret;
struct sk_buff *skb; struct sk_buff *skb;
char *data;
if (size > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { if (size > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
lbs_deb_sdio("response packet too large (%d bytes)\n", lbs_deb_sdio("response packet too large (%d bytes)\n",
@ -256,7 +255,7 @@ static int if_sdio_handle_data(struct if_sdio_card *card,
skb_reserve(skb, NET_IP_ALIGN); skb_reserve(skb, NET_IP_ALIGN);
data = skb_put_data(skb, buffer, size); skb_put_data(skb, buffer, size);
lbs_process_rxed_packet(card->priv, skb); lbs_process_rxed_packet(card->priv, skb);

View File

@ -33,9 +33,7 @@ static inline void qtnf_cmd_skb_put_action(struct sk_buff *skb, u16 action)
static inline void static inline void
qtnf_cmd_skb_put_buffer(struct sk_buff *skb, const u8 *buf_src, size_t len) qtnf_cmd_skb_put_buffer(struct sk_buff *skb, const u8 *buf_src, size_t len)
{ {
u8 *buf_dst; skb_put_data(skb, buf_src, len);
buf_dst = skb_put_data(skb, buf_src, len);
} }
static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb, static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb,

View File

@ -729,13 +729,12 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw,
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} else { } else {
struct sk_buff *uskb = NULL; struct sk_buff *uskb = NULL;
u8 *pdata;
uskb = dev_alloc_skb(skb->len + 128); uskb = dev_alloc_skb(skb->len + 128);
if (likely(uskb)) { if (likely(uskb)) {
memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status,
sizeof(rx_status)); sizeof(rx_status));
pdata = skb_put_data(uskb, skb->data, skb->len); skb_put_data(uskb, skb->data, skb->len);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
ieee80211_rx_irqsafe(hw, uskb); ieee80211_rx_irqsafe(hw, uskb);
} else { } else {

View File

@ -647,8 +647,7 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet, totalpacketlen);
&reserved_page_packet, totalpacketlen);
if (cmd_send_packet) if (cmd_send_packet)
rtstatus = cmd_send_packet(hw, skb); rtstatus = cmd_send_packet(hw, skb);

View File

@ -668,8 +668,7 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
if (!skb) { if (!skb) {
dlok = false; dlok = false;
} else { } else {
memcpy((u8 *) skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet, totalpacketlen);
&reserved_page_packet, totalpacketlen);
rtstatus = _rtl92d_cmd_send_packet(hw, skb); rtstatus = _rtl92d_cmd_send_packet(hw, skb);
if (rtstatus) if (rtstatus)

View File

@ -708,8 +708,7 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
u1rsvdpageloc, 3); u1rsvdpageloc, 3);
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet, totalpacketlen);
&reserved_page_packet, totalpacketlen);
b_dlok = true; b_dlok = true;

View File

@ -470,8 +470,7 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
u1rsvdpageloc, 3); u1rsvdpageloc, 3);
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet, totalpacketlen);
&reserved_page_packet, totalpacketlen);
rtstatus = rtl_cmd_send_packet(hw, skb); rtstatus = rtl_cmd_send_packet(hw, skb);

View File

@ -527,8 +527,7 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
u1rsvdpageloc, sizeof(u1rsvdpageloc)); u1rsvdpageloc, sizeof(u1rsvdpageloc));
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet, totalpacketlen);
&reserved_page_packet, totalpacketlen);
rtstatus = rtl_cmd_send_packet(hw, skb); rtstatus = rtl_cmd_send_packet(hw, skb);

View File

@ -1588,8 +1588,7 @@ out:
&reserved_page_packet_8812[0], totalpacketlen); &reserved_page_packet_8812[0], totalpacketlen);
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet_8812, totalpacketlen);
&reserved_page_packet_8812, totalpacketlen);
rtstatus = rtl_cmd_send_packet(hw, skb); rtstatus = rtl_cmd_send_packet(hw, skb);
@ -1725,8 +1724,7 @@ out:
&reserved_page_packet_8821[0], totalpacketlen); &reserved_page_packet_8821[0], totalpacketlen);
skb = dev_alloc_skb(totalpacketlen); skb = dev_alloc_skb(totalpacketlen);
memcpy((u8 *)skb_put(skb, totalpacketlen), skb_put_data(skb, &reserved_page_packet_8821, totalpacketlen);
&reserved_page_packet_8821, totalpacketlen);
rtstatus = rtl_cmd_send_packet(hw, skb); rtstatus = rtl_cmd_send_packet(hw, skb);

View File

@ -389,9 +389,7 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct skb_info *rx_params; struct skb_info *rx_params;
u8 pad_bytes = msg[4]; u8 pad_bytes = msg[4];
u8 pkt_recv;
struct sk_buff *skb; struct sk_buff *skb;
char *buffer;
if (type == RX_DOT11_MGMT) { if (type == RX_DOT11_MGMT) {
if (!adapter->sc_nvifs) if (!adapter->sc_nvifs)
@ -412,11 +410,9 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
return -ENOMEM; return -ENOMEM;
} }
buffer = skb_put_data(skb, skb_put_data(skb,
(u8 *)(msg + FRAME_DESC_SZ + pad_bytes), (u8 *)(msg + FRAME_DESC_SZ + pad_bytes),
msg_len); msg_len);
pkt_recv = buffer[0];
info = IEEE80211_SKB_CB(skb); info = IEEE80211_SKB_CB(skb);
rx_params = (struct skb_info *)info->driver_data; rx_params = (struct skb_info *)info->driver_data;

View File

@ -117,7 +117,6 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
struct wl1271_rx_descriptor *desc; struct wl1271_rx_descriptor *desc;
struct sk_buff *skb; struct sk_buff *skb;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
u8 *buf;
u8 beacon = 0; u8 beacon = 0;
u8 is_data = 0; u8 is_data = 0;
u8 reserved = 0, offset_to_data = 0; u8 reserved = 0, offset_to_data = 0;
@ -180,7 +179,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
* packets copy the packets in offset of 2 bytes guarantee IP header * packets copy the packets in offset of 2 bytes guarantee IP header
* payload aligned to 4 bytes. * payload aligned to 4 bytes.
*/ */
buf = skb_put_data(skb, data + sizeof(*desc), pkt_data_len); skb_put_data(skb, data + sizeof(*desc), pkt_data_len);
if (rx_align == WLCORE_RX_BUF_PADDED) if (rx_align == WLCORE_RX_BUF_PADDED)
skb_pull(skb, RX_BUF_ALIGN); skb_pull(skb, RX_BUF_ALIGN);

View File

@ -1006,7 +1006,7 @@ static int pn533_start_poll_complete(struct pn533 *dev, struct sk_buff *resp)
static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev) static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev)
{ {
struct sk_buff *skb; struct sk_buff *skb;
u8 *felica, *nfcid3, *gb; u8 *felica, *nfcid3;
u8 *gbytes = dev->gb; u8 *gbytes = dev->gb;
size_t gbytes_len = dev->gb_len; size_t gbytes_len = dev->gb_len;
@ -1048,7 +1048,7 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev)
/* General bytes */ /* General bytes */
skb_put_u8(skb, gbytes_len); skb_put_u8(skb, gbytes_len);
gb = skb_put_data(skb, gbytes, gbytes_len); skb_put_data(skb, gbytes, gbytes_len);
/* Len Tk */ /* Len Tk */
skb_put_u8(skb, 0); skb_put_u8(skb, 0);

View File

@ -251,8 +251,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
if ((skb_tail_pointer(skb) + add_bytes) <= if ((skb_tail_pointer(skb) + add_bytes) <=
skb_end_pointer(skb)) skb_end_pointer(skb))
memset(__skb_put(skb, add_bytes), 0, __skb_put_zero(skb, add_bytes);
add_bytes);
} }
} }
} }

View File

@ -1510,7 +1510,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
u8 nr_subframes, i; u8 nr_subframes, i;
unsigned char *pdata; unsigned char *pdata;
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
unsigned char *data_ptr;
struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue); struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue);
@ -1544,8 +1543,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
sub_skb = dev_alloc_skb(nSubframe_Length + 12); sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (sub_skb) { if (sub_skb) {
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, pdata, skb_put_data(sub_skb, pdata, nSubframe_Length);
nSubframe_Length);
} else { } else {
sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC);
if (sub_skb) { if (sub_skb) {

View File

@ -782,7 +782,6 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
u8 nPadding_Length = 0; u8 nPadding_Length = 0;
u16 SeqNum = 0; u16 SeqNum = 0;
struct sk_buff *sub_skb; struct sk_buff *sub_skb;
u8 *data_ptr;
/* just for debug purpose */ /* just for debug purpose */
SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl));
if ((RTLLIB_QOS_HAS_SEQ(fc)) && if ((RTLLIB_QOS_HAS_SEQ(fc)) &&
@ -817,7 +816,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
if (!sub_skb) if (!sub_skb)
return 0; return 0;
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, skb->data, skb->len); skb_put_data(sub_skb, skb->data, skb->len);
sub_skb->dev = ieee->dev; sub_skb->dev = ieee->dev;
rxb->subframes[0] = sub_skb; rxb->subframes[0] = sub_skb;
@ -869,7 +868,7 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
if (!sub_skb) if (!sub_skb)
return 0; return 0;
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, skb->data, nSubframe_Length); skb_put_data(sub_skb, skb->data, nSubframe_Length);
sub_skb->dev = ieee->dev; sub_skb->dev = ieee->dev;
rxb->subframes[rxb->nr_subframes++] = sub_skb; rxb->subframes[rxb->nr_subframes++] = sub_skb;

View File

@ -1264,7 +1264,7 @@ rtllib_association_req(struct rtllib_network *beacon,
hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].id = MFIE_TYPE_SSID;
hdr->info_element[0].len = beacon->ssid_len; hdr->info_element[0].len = beacon->ssid_len;
tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); skb_put_data(skb, beacon->ssid, beacon->ssid_len);
tag = skb_put(skb, rate_len); tag = skb_put(skb, rate_len);
@ -1340,7 +1340,7 @@ rtllib_association_req(struct rtllib_network *beacon,
} }
if (wpa_ie_len) { if (wpa_ie_len) {
tag = skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len);
if (PMKCacheIdx >= 0) { if (PMKCacheIdx >= 0) {
tag = skb_put(skb, 18); tag = skb_put(skb, 18);
@ -1356,12 +1356,13 @@ rtllib_association_req(struct rtllib_network *beacon,
} }
if (wps_ie_len && ieee->wps_ie) { if (wps_ie_len && ieee->wps_ie) {
tag = skb_put_data(skb, ieee->wps_ie, wps_ie_len); skb_put_data(skb, ieee->wps_ie, wps_ie_len);
} }
tag = skb_put(skb, turbo_info_len); if (turbo_info_len) {
if (turbo_info_len) tag = skb_put(skb, turbo_info_len);
rtllib_TURBO_Info(ieee, &tag); rtllib_TURBO_Info(ieee, &tag);
}
if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) {
if (ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) { if (ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) {

View File

@ -780,7 +780,6 @@ static u8 parse_subframe(struct sk_buff *skb,
u16 SeqNum=0; u16 SeqNum=0;
struct sk_buff *sub_skb; struct sk_buff *sub_skb;
u8 *data_ptr;
/* just for debug purpose */ /* just for debug purpose */
SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl));
@ -848,8 +847,7 @@ static u8 parse_subframe(struct sk_buff *skb,
if (!sub_skb) if (!sub_skb)
return 0; return 0;
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, skb->data, skb_put_data(sub_skb, skb->data, nSubframe_Length);
nSubframe_Length);
#endif #endif
rxb->subframes[rxb->nr_subframes++] = sub_skb; rxb->subframes[rxb->nr_subframes++] = sub_skb;
if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) {

View File

@ -1112,7 +1112,7 @@ ieee80211_association_req(struct ieee80211_network *beacon,
hdr->info_element[0].id = MFIE_TYPE_SSID; hdr->info_element[0].id = MFIE_TYPE_SSID;
hdr->info_element[0].len = beacon->ssid_len; hdr->info_element[0].len = beacon->ssid_len;
tag = skb_put_data(skb, beacon->ssid, beacon->ssid_len); skb_put_data(skb, beacon->ssid, beacon->ssid_len);
tag = skb_put(skb, rate_len); tag = skb_put(skb, rate_len);
@ -1184,18 +1184,17 @@ ieee80211_association_req(struct ieee80211_network *beacon,
//choose what wpa_supplicant gives to associate. //choose what wpa_supplicant gives to associate.
tag = skb_put(skb, wpa_ie_len);
if (wpa_ie_len) { if (wpa_ie_len) {
memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); skb_put_data(skb, ieee->wpa_ie, wpa_ie_len);
} }
tag = skb_put(skb, wmm_info_len);
if (wmm_info_len) { if (wmm_info_len) {
ieee80211_WMM_Info(ieee, &tag); tag = skb_put(skb, wmm_info_len);
ieee80211_WMM_Info(ieee, &tag);
} }
#ifdef THOMAS_TURBO #ifdef THOMAS_TURBO
tag = skb_put(skb, turbo_info_len);
if (turbo_info_len) { if (turbo_info_len) {
tag = skb_put(skb, turbo_info_len);
ieee80211_TURBO_Info(ieee, &tag); ieee80211_TURBO_Info(ieee, &tag);
} }
#endif #endif

View File

@ -31,7 +31,6 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
struct r8192_priv *priv = ieee80211_priv(dev); struct r8192_priv *priv = ieee80211_priv(dev);
struct sk_buff *skb; struct sk_buff *skb;
struct cb_desc *tcb_desc; struct cb_desc *tcb_desc;
unsigned char *ptr_buf;
/* Get TCB and local buffer from common pool. /* Get TCB and local buffer from common pool.
* (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) * (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
@ -45,7 +44,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL;
tcb_desc->bLastIniPkt = 0; tcb_desc->bLastIniPkt = 0;
skb_reserve(skb, USB_HWDESC_HEADER_LEN); skb_reserve(skb, USB_HWDESC_HEADER_LEN);
ptr_buf = skb_put_data(skb, pData, DataLen); skb_put_data(skb, pData, DataLen);
tcb_desc->txbuf_size = (u16)DataLen; tcb_desc->txbuf_size = (u16)DataLen;
if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) ||

View File

@ -340,7 +340,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
int a_len, padding_len; int a_len, padding_len;
u16 eth_type, nSubframe_Length; u16 eth_type, nSubframe_Length;
u8 nr_subframes, i; u8 nr_subframes, i;
unsigned char *data_ptr, *pdata; unsigned char *pdata;
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
_pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; _pkt *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv; struct recv_priv *precvpriv = &padapter->recvpriv;
@ -372,7 +372,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
if (!sub_skb) if (!sub_skb)
break; break;
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, pdata, nSubframe_Length); skb_put_data(sub_skb, pdata, nSubframe_Length);
subframes[nr_subframes++] = sub_skb; subframes[nr_subframes++] = sub_skb;
if (nr_subframes >= MAX_SUBFRAME_COUNT) { if (nr_subframes >= MAX_SUBFRAME_COUNT) {
netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n"); netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n");

View File

@ -72,7 +72,6 @@ int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *prec
_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata)
{ {
u16 eth_type; u16 eth_type;
u8 *data_ptr;
_pkt *sub_skb; _pkt *sub_skb;
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
@ -82,8 +81,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8
if (sub_skb) if (sub_skb)
{ {
skb_reserve(sub_skb, 12); skb_reserve(sub_skb, 12);
data_ptr = skb_put_data(sub_skb, (pdata + ETH_HLEN), skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length);
nSubframe_Length);
} }
else else
{ {

View File

@ -3530,7 +3530,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
/* Copy the 802.11 header to the skb /* Copy the 802.11 header to the skb
* (ctl frames may be less than a full header) * (ctl frames may be less than a full header)
*/ */
datap = skb_put_data(skb, &rxdesc->frame_control, hdrlen); skb_put_data(skb, &rxdesc->frame_control, hdrlen);
/* If any, copy the data from the card to the skb */ /* If any, copy the data from the card to the skb */
if (datalen > 0) { if (datalen > 0) {

View File

@ -1085,8 +1085,7 @@ cxgbit_pass_accept_rpl(struct cxgbit_sock *csk, struct cpl_pass_accept_req *req)
return; return;
} }
rpl5 = __skb_put(skb, len); rpl5 = __skb_put_zero(skb, len);
memset(rpl5, 0, len);
INIT_TP_WR(rpl5, csk->tid); INIT_TP_WR(rpl5, csk->tid);
OPCODE_TID(rpl5) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL, OPCODE_TID(rpl5) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
@ -1367,8 +1366,7 @@ u32 cxgbit_send_tx_flowc_wr(struct cxgbit_sock *csk)
flowclen16 = cxgbit_tx_flowc_wr_credits(csk, &nparams, &flowclen); flowclen16 = cxgbit_tx_flowc_wr_credits(csk, &nparams, &flowclen);
skb = __skb_dequeue(&csk->skbq); skb = __skb_dequeue(&csk->skbq);
flowc = __skb_put(skb, flowclen); flowc = __skb_put_zero(skb, flowclen);
memset(flowc, 0, flowclen);
flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) | flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
FW_FLOWC_WR_NPARAMS_V(nparams)); FW_FLOWC_WR_NPARAMS_V(nparams));
@ -1439,8 +1437,7 @@ int cxgbit_setup_conn_digest(struct cxgbit_sock *csk)
return -ENOMEM; return -ENOMEM;
/* set up ulp submode */ /* set up ulp submode */
req = __skb_put(skb, len); req = __skb_put_zero(skb, len);
memset(req, 0, len);
INIT_TP_WR(req, csk->tid); INIT_TP_WR(req, csk->tid);
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid));
@ -1476,8 +1473,7 @@ int cxgbit_setup_conn_pgidx(struct cxgbit_sock *csk, u32 pg_idx)
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
req = __skb_put(skb, len); req = __skb_put_zero(skb, len);
memset(req, 0, len);
INIT_TP_WR(req, csk->tid); INIT_TP_WR(req, csk->tid);
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid));

View File

@ -1004,16 +1004,15 @@ static struct sk_buff *package_for_tx(struct f_ncm *ncm)
} }
/* Insert NDP alignment. */ /* Insert NDP alignment. */
ntb_iter = skb_put_zero(skb2, ndp_pad); skb_put_zero(skb2, ndp_pad);
/* Copy NTB across. */ /* Copy NTB across. */
ntb_iter = skb_put_data(skb2, ncm->skb_tx_ndp->data, skb_put_data(skb2, ncm->skb_tx_ndp->data, ncm->skb_tx_ndp->len);
ncm->skb_tx_ndp->len);
dev_consume_skb_any(ncm->skb_tx_ndp); dev_consume_skb_any(ncm->skb_tx_ndp);
ncm->skb_tx_ndp = NULL; ncm->skb_tx_ndp = NULL;
/* Insert zero'd datagram. */ /* Insert zero'd datagram. */
ntb_iter = skb_put_zero(skb2, dgram_idx_len); skb_put_zero(skb2, dgram_idx_len);
return skb2; return skb2;
} }
@ -1127,8 +1126,8 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port,
ncm->ndp_dgram_count++; ncm->ndp_dgram_count++;
/* Add the new data to the skb */ /* Add the new data to the skb */
ntb_data = skb_put_zero(ncm->skb_tx_data, dgram_pad); skb_put_zero(ncm->skb_tx_data, dgram_pad);
ntb_data = skb_put_data(ncm->skb_tx_data, skb->data, skb->len); skb_put_data(ncm->skb_tx_data, skb->data, skb->len);
dev_consume_skb_any(skb); dev_consume_skb_any(skb);
skb = NULL; skb = NULL;

View File

@ -1904,6 +1904,28 @@ static inline void *__skb_put(struct sk_buff *skb, unsigned int len)
return tmp; return tmp;
} }
static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len)
{
void *tmp = __skb_put(skb, len);
memset(tmp, 0, len);
return tmp;
}
static inline void *__skb_put_data(struct sk_buff *skb, const void *data,
unsigned int len)
{
void *tmp = __skb_put(skb, len);
memcpy(tmp, data, len);
return tmp;
}
static inline void __skb_put_u8(struct sk_buff *skb, u8 val)
{
*(u8 *)__skb_put(skb, 1) = val;
}
static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len) static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len)
{ {
void *tmp = skb_put(skb, len); void *tmp = skb_put(skb, len);

View File

@ -398,11 +398,7 @@ EXPORT_SYMBOL(__nla_reserve_64bit);
*/ */
void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen) void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
{ {
void *start; return skb_put_zero(skb, NLA_ALIGN(attrlen));
start = skb_put_zero(skb, NLA_ALIGN(attrlen));
return start;
} }
EXPORT_SYMBOL(__nla_reserve_nohdr); EXPORT_SYMBOL(__nla_reserve_nohdr);

View File

@ -5717,7 +5717,7 @@ static struct sk_buff *populate_skb(char *buf, int size)
if (!skb) if (!skb)
return NULL; return NULL;
memcpy(__skb_put(skb, size), buf, size); __skb_put_data(skb, buf, size);
/* Initialize a fake skb with test pattern. */ /* Initialize a fake skb with test pattern. */
skb_reset_mac_header(skb); skb_reset_mac_header(skb);

View File

@ -232,7 +232,7 @@ static int garp_pdu_append_end_mark(struct garp_applicant *app)
{ {
if (skb_tailroom(app->pdu) < sizeof(u8)) if (skb_tailroom(app->pdu) < sizeof(u8))
return -1; return -1;
*(u8 *)__skb_put(app->pdu, sizeof(u8)) = GARP_END_MARK; __skb_put_u8(app->pdu, GARP_END_MARK);
return 0; return 0;
} }

View File

@ -374,25 +374,22 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
/* Decompress header and construct ether frame */ /* Decompress header and construct ether frame */
switch (type & BNEP_TYPE_MASK) { switch (type & BNEP_TYPE_MASK) {
case BNEP_COMPRESSED: case BNEP_COMPRESSED:
memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN); __skb_put_data(nskb, &s->eh, ETH_HLEN);
break; break;
case BNEP_COMPRESSED_SRC_ONLY: case BNEP_COMPRESSED_SRC_ONLY:
memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); __skb_put_data(nskb, s->eh.h_dest, ETH_ALEN);
memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), ETH_ALEN); __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN);
put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2));
break; break;
case BNEP_COMPRESSED_DST_ONLY: case BNEP_COMPRESSED_DST_ONLY:
memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN);
ETH_ALEN); __skb_put_data(nskb, s->eh.h_source, ETH_ALEN + 2);
memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source,
ETH_ALEN + 2);
break; break;
case BNEP_GENERAL: case BNEP_GENERAL:
memcpy(__skb_put(nskb, ETH_ALEN * 2), skb_mac_header(skb), __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN * 2);
ETH_ALEN * 2);
put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2));
break; break;
} }

View File

@ -75,16 +75,16 @@ static void bnep_net_set_mc_list(struct net_device *dev)
u8 start[ETH_ALEN] = { 0x01 }; u8 start[ETH_ALEN] = { 0x01 };
/* Request all addresses */ /* Request all addresses */
memcpy(__skb_put(skb, ETH_ALEN), start, ETH_ALEN); __skb_put_data(skb, start, ETH_ALEN);
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); __skb_put_data(skb, dev->broadcast, ETH_ALEN);
r->len = htons(ETH_ALEN * 2); r->len = htons(ETH_ALEN * 2);
} else { } else {
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
int i, len = skb->len; int i, len = skb->len;
if (dev->flags & IFF_BROADCAST) { if (dev->flags & IFF_BROADCAST) {
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); __skb_put_data(skb, dev->broadcast, ETH_ALEN);
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); __skb_put_data(skb, dev->broadcast, ETH_ALEN);
} }
/* FIXME: We should group addresses here. */ /* FIXME: We should group addresses here. */
@ -93,8 +93,8 @@ static void bnep_net_set_mc_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
if (i == BNEP_MAX_MULTICAST_FILTERS) if (i == BNEP_MAX_MULTICAST_FILTERS)
break; break;
memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); __skb_put_data(skb, ha->addr, ETH_ALEN);
memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); __skb_put_data(skb, ha->addr, ETH_ALEN);
i++; i++;
} }

View File

@ -50,7 +50,7 @@ static void br_send_bpdu(struct net_bridge_port *p,
skb->priority = TC_PRIO_CONTROL; skb->priority = TC_PRIO_CONTROL;
skb_reserve(skb, LLC_RESERVE); skb_reserve(skb, LLC_RESERVE);
memcpy(__skb_put(skb, length), data, length); __skb_put_data(skb, data, length);
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, LLC_SAP_BSPAN, llc_pdu_header_init(skb, LLC_PDU_TYPE_U, LLC_SAP_BSPAN,
LLC_SAP_BSPAN, LLC_PDU_CMD); LLC_SAP_BSPAN, LLC_PDU_CMD);

View File

@ -107,7 +107,6 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
struct iphdr *niph; struct iphdr *niph;
struct icmphdr *icmph; struct icmphdr *icmph;
unsigned int len; unsigned int len;
void *payload;
__wsum csum; __wsum csum;
u8 proto; u8 proto;
@ -151,7 +150,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
icmph->type = ICMP_DEST_UNREACH; icmph->type = ICMP_DEST_UNREACH;
icmph->code = code; icmph->code = code;
payload = skb_put_data(nskb, skb_network_header(oldskb), len); skb_put_data(nskb, skb_network_header(oldskb), len);
csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0); csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0);
icmph->checksum = csum_fold(csum); icmph->checksum = csum_fold(csum);
@ -247,7 +246,6 @@ static void nft_reject_br_send_v6_unreach(struct net *net,
struct ipv6hdr *nip6h; struct ipv6hdr *nip6h;
struct icmp6hdr *icmp6h; struct icmp6hdr *icmp6h;
unsigned int len; unsigned int len;
void *payload;
if (!nft_bridge_ip6hdr_validate(oldskb)) if (!nft_bridge_ip6hdr_validate(oldskb))
return; return;
@ -277,7 +275,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net,
icmp6h->icmp6_type = ICMPV6_DEST_UNREACH; icmp6h->icmp6_type = ICMPV6_DEST_UNREACH;
icmp6h->icmp6_code = code; icmp6h->icmp6_code = code;
payload = skb_put_data(nskb, skb_network_header(oldskb), len); skb_put_data(nskb, skb_network_header(oldskb), len);
nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr));
icmp6h->icmp6_cksum = icmp6h->icmp6_cksum =

View File

@ -43,8 +43,7 @@ static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev)
kfree_skb(skb); kfree_skb(skb);
if (padlen) { if (padlen) {
u8 *pad = skb_put(nskb, padlen); skb_put_zero(nskb, padlen);
memset(pad, 0, padlen);
} }
trailer = skb_put(nskb, 4); trailer = skb_put(nskb, 4);

View File

@ -284,12 +284,12 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
if (hsrVer > 0) { if (hsrVer > 0) {
hsr_tag = (typeof(hsr_tag)) skb_put(skb, sizeof(struct hsr_tag)); hsr_tag = skb_put(skb, sizeof(struct hsr_tag));
hsr_tag->encap_proto = htons(ETH_P_PRP); hsr_tag->encap_proto = htons(ETH_P_PRP);
set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE); set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE);
} }
hsr_stag = (typeof(hsr_stag)) skb_put(skb, sizeof(struct hsr_sup_tag)); hsr_stag = skb_put(skb, sizeof(struct hsr_sup_tag));
set_hsr_stag_path(hsr_stag, (hsrVer ? 0x0 : 0xf)); set_hsr_stag_path(hsr_stag, (hsrVer ? 0x0 : 0xf));
set_hsr_stag_HSR_Ver(hsr_stag, hsrVer); set_hsr_stag_HSR_Ver(hsr_stag, hsrVer);
@ -311,7 +311,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
hsr_stag->HSR_TLV_Length = hsrVer ? sizeof(struct hsr_sup_payload) : 12; hsr_stag->HSR_TLV_Length = hsrVer ? sizeof(struct hsr_sup_payload) : 12;
/* Payload: MacAddressA */ /* Payload: MacAddressA */
hsr_sp = (typeof(hsr_sp)) skb_put(skb, sizeof(struct hsr_sup_payload)); hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload));
ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr); ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr);
skb_put_padto(skb, ETH_ZLEN + HSR_HLEN); skb_put_padto(skb, ETH_ZLEN + HSR_HLEN);

View File

@ -392,7 +392,7 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
info[0] = discovery->data.charset; info[0] = discovery->data.charset;
len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb)); len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb));
info = skb_put_data(tx_skb, discovery->data.info, len); skb_put_data(tx_skb, discovery->data.info, len);
} }
irlap_queue_xmit(self, tx_skb); irlap_queue_xmit(self, tx_skb);
} }
@ -1194,7 +1194,6 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
{ {
struct sk_buff *tx_skb; struct sk_buff *tx_skb;
struct test_frame *frame; struct test_frame *frame;
__u8 *info;
tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC); tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC);
if (!tx_skb) if (!tx_skb)
@ -1214,7 +1213,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
frame->control = TEST_RSP | PF_BIT; frame->control = TEST_RSP | PF_BIT;
/* Copy info */ /* Copy info */
info = skb_put_data(tx_skb, cmd->data, cmd->len); skb_put_data(tx_skb, cmd->data, cmd->len);
/* Return to sender */ /* Return to sender */
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);

View File

@ -796,8 +796,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
after_ric, after_ric,
ARRAY_SIZE(after_ric), ARRAY_SIZE(after_ric),
offset); offset);
pos = skb_put_data(skb, assoc_data->ie + offset, skb_put_data(skb, assoc_data->ie + offset, noffset - offset);
noffset - offset);
offset = noffset; offset = noffset;
} }
@ -834,8 +833,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len,
before_vht, ARRAY_SIZE(before_vht), before_vht, ARRAY_SIZE(before_vht),
offset); offset);
pos = skb_put_data(skb, assoc_data->ie + offset, skb_put_data(skb, assoc_data->ie + offset, noffset - offset);
noffset - offset);
offset = noffset; offset = noffset;
} }
@ -848,8 +846,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
noffset = ieee80211_ie_split_vendor(assoc_data->ie, noffset = ieee80211_ie_split_vendor(assoc_data->ie,
assoc_data->ie_len, assoc_data->ie_len,
offset); offset);
pos = skb_put_data(skb, assoc_data->ie + offset, skb_put_data(skb, assoc_data->ie + offset, noffset - offset);
noffset - offset);
offset = noffset; offset = noffset;
} }
@ -868,8 +865,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
/* add any remaining custom (i.e. vendor specific here) IEs */ /* add any remaining custom (i.e. vendor specific here) IEs */
if (assoc_data->ie_len) { if (assoc_data->ie_len) {
noffset = assoc_data->ie_len; noffset = assoc_data->ie_len;
pos = skb_put_data(skb, assoc_data->ie + offset, skb_put_data(skb, assoc_data->ie + offset, noffset - offset);
noffset - offset);
} }
if (assoc_data->fils_kek_len && if (assoc_data->fils_kek_len &&

View File

@ -388,7 +388,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
before_ext_cap, before_ext_cap,
ARRAY_SIZE(before_ext_cap), ARRAY_SIZE(before_ext_cap),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -417,7 +417,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
before_ht_cap, before_ht_cap,
ARRAY_SIZE(before_ht_cap), ARRAY_SIZE(before_ht_cap),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -488,7 +488,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
before_vht_cap, before_vht_cap,
ARRAY_SIZE(before_vht_cap), ARRAY_SIZE(before_vht_cap),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -529,7 +529,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
/* add any remaining IEs */ /* add any remaining IEs */
if (extra_ies_len) { if (extra_ies_len) {
noffset = extra_ies_len; noffset = extra_ies_len;
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
} }
} }
@ -571,7 +571,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
before_qos, before_qos,
ARRAY_SIZE(before_qos), ARRAY_SIZE(before_qos),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -591,7 +591,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
before_ht_op, before_ht_op,
ARRAY_SIZE(before_ht_op), ARRAY_SIZE(before_ht_op),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -632,7 +632,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
/* add any remaining IEs */ /* add any remaining IEs */
if (extra_ies_len) { if (extra_ies_len) {
noffset = extra_ies_len; noffset = extra_ies_len;
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
} }
} }
@ -645,7 +645,6 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata,
{ {
struct ieee80211_tdls_data *tf; struct ieee80211_tdls_data *tf;
size_t offset = 0, noffset; size_t offset = 0, noffset;
u8 *pos;
if (WARN_ON_ONCE(!chandef)) if (WARN_ON_ONCE(!chandef))
return; return;
@ -663,7 +662,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata,
before_lnkie, before_lnkie,
ARRAY_SIZE(before_lnkie), ARRAY_SIZE(before_lnkie),
offset); offset);
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
offset = noffset; offset = noffset;
} }
@ -672,7 +671,7 @@ ieee80211_tdls_add_chan_switch_req_ies(struct ieee80211_sub_if_data *sdata,
/* add any remaining IEs */ /* add any remaining IEs */
if (extra_ies_len) { if (extra_ies_len) {
noffset = extra_ies_len; noffset = extra_ies_len;
pos = skb_put_data(skb, extra_ies + offset, noffset - offset); skb_put_data(skb, extra_ies + offset, noffset - offset);
} }
} }

View File

@ -1474,11 +1474,10 @@ void sctp_chunk_put(struct sctp_chunk *ch)
void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
{ {
void *target; void *target;
void *padding;
int chunklen = ntohs(chunk->chunk_hdr->length); int chunklen = ntohs(chunk->chunk_hdr->length);
int padlen = SCTP_PAD4(chunklen) - chunklen; int padlen = SCTP_PAD4(chunklen) - chunklen;
padding = skb_put_zero(chunk->skb, padlen); skb_put_zero(chunk->skb, padlen);
target = skb_put_data(chunk->skb, data, len); target = skb_put_data(chunk->skb, data, len);
/* Adjust the chunk length field. */ /* Adjust the chunk length field. */

View File

@ -90,7 +90,6 @@ out_pkt:
static struct sk_buff *virtio_transport_build_skb(void *opaque) static struct sk_buff *virtio_transport_build_skb(void *opaque)
{ {
struct virtio_vsock_pkt *pkt = opaque; struct virtio_vsock_pkt *pkt = opaque;
unsigned char *t_hdr, *payload;
struct af_vsockmon_hdr *hdr; struct af_vsockmon_hdr *hdr;
struct sk_buff *skb; struct sk_buff *skb;
@ -132,10 +131,10 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque)
break; break;
} }
t_hdr = skb_put_data(skb, &pkt->hdr, sizeof(pkt->hdr)); skb_put_data(skb, &pkt->hdr, sizeof(pkt->hdr));
if (pkt->len) { if (pkt->len) {
payload = skb_put_data(skb, pkt->buf, pkt->len); skb_put_data(skb, pkt->buf, pkt->len);
} }
return skb; return skb;

View File

@ -188,14 +188,14 @@ void x25_write_internal(struct sock *sk, int frametype)
*dptr++ = X25_CALL_REQUEST; *dptr++ = X25_CALL_REQUEST;
len = x25_addr_aton(addresses, &x25->dest_addr, len = x25_addr_aton(addresses, &x25->dest_addr,
&x25->source_addr); &x25->source_addr);
dptr = skb_put_data(skb, addresses, len); skb_put_data(skb, addresses, len);
len = x25_create_facilities(facilities, len = x25_create_facilities(facilities,
&x25->facilities, &x25->facilities,
&x25->dte_facilities, &x25->dte_facilities,
x25->neighbour->global_facil_mask); x25->neighbour->global_facil_mask);
dptr = skb_put_data(skb, facilities, len); skb_put_data(skb, facilities, len);
dptr = skb_put_data(skb, x25->calluserdata.cuddata, skb_put_data(skb, x25->calluserdata.cuddata,
x25->calluserdata.cudlength); x25->calluserdata.cudlength);
x25->calluserdata.cudlength = 0; x25->calluserdata.cudlength = 0;
break; break;
@ -207,15 +207,15 @@ void x25_write_internal(struct sock *sk, int frametype)
&x25->facilities, &x25->facilities,
&x25->dte_facilities, &x25->dte_facilities,
x25->vc_facil_mask); x25->vc_facil_mask);
dptr = skb_put_data(skb, facilities, len); skb_put_data(skb, facilities, len);
/* fast select with no restriction on response /* fast select with no restriction on response
allows call user data. Userland must allows call user data. Userland must
ensure it is ours and not theirs */ ensure it is ours and not theirs */
if(x25->facilities.reverse & 0x80) { if(x25->facilities.reverse & 0x80) {
dptr = skb_put_data(skb, skb_put_data(skb,
x25->calluserdata.cuddata, x25->calluserdata.cuddata,
x25->calluserdata.cudlength); x25->calluserdata.cudlength);
} }
x25->calluserdata.cudlength = 0; x25->calluserdata.cudlength = 0;
break; break;