diff options
author | Mathias Krause <mathias.krause@secunet.com> | 2013-11-07 08:18:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-07 19:28:59 -0500 |
commit | 253c6daa343104c1278facd11cb5ecfc7554fb38 (patch) | |
tree | 97e4ff68f7c9e196f1cfbd16070f19f8f46fe4e0 | |
parent | 0c7ddf36c29c3ce12f2d2931a357ccaa0861035a (diff) |
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: Mathias Krause <mathias.krause@secunet.com>
Cc: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/caif/cfpkt_skbuff.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c index 6493351f39c6..1be0b521ac49 100644 --- a/net/caif/cfpkt_skbuff.c +++ b/net/caif/cfpkt_skbuff.c | |||
@@ -203,20 +203,10 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len) | |||
203 | PKT_ERROR(pkt, "cow failed\n"); | 203 | PKT_ERROR(pkt, "cow failed\n"); |
204 | return -EPROTO; | 204 | return -EPROTO; |
205 | } | 205 | } |
206 | /* | ||
207 | * Is the SKB non-linear after skb_cow_data()? If so, we are | ||
208 | * going to add data to the last SKB, so we need to adjust | ||
209 | * lengths of the top SKB. | ||
210 | */ | ||
211 | if (lastskb != skb) { | ||
212 | pr_warn("Packet is non-linear\n"); | ||
213 | skb->len += len; | ||
214 | skb->data_len += len; | ||
215 | } | ||
216 | } | 206 | } |
217 | 207 | ||
218 | /* All set to put the last SKB and optionally write data there. */ | 208 | /* All set to put the last SKB and optionally write data there. */ |
219 | to = skb_put(lastskb, len); | 209 | to = pskb_put(skb, lastskb, len); |
220 | if (likely(data)) | 210 | if (likely(data)) |
221 | memcpy(to, data, len); | 211 | memcpy(to, data, len); |
222 | return 0; | 212 | return 0; |