Commit 253c6daa authored by Mathias Krause's avatar Mathias Krause Committed by David S. Miller

caif: use pskb_put() instead of reimplementing its functionality

Also remove the warning for fragmented packets -- skb_cow_data() will
linearize the buffer, removing all fragments.
Signed-off-by: default avatarMathias Krause <mathias.krause@secunet.com>
Cc: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0c7ddf36
......@@ -203,20 +203,10 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len)
PKT_ERROR(pkt, "cow failed\n");
return -EPROTO;
}
/*
* Is the SKB non-linear after skb_cow_data()? If so, we are
* going to add data to the last SKB, so we need to adjust
* lengths of the top SKB.
*/
if (lastskb != skb) {
pr_warn("Packet is non-linear\n");
skb->len += len;
skb->data_len += len;
}
}
/* All set to put the last SKB and optionally write data there. */
to = skb_put(lastskb, len);
to = pskb_put(skb, lastskb, len);
if (likely(data))
memcpy(to, data, len);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment