Skip to content

Commit 253c6da

Browse files
Mathias Krausedavem330
authored andcommitted
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>
1 parent 0c7ddf3 commit 253c6da

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎net/caif/cfpkt_skbuff.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,10 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len)
203203
PKT_ERROR(pkt, "cow failed\n");
204204
return -EPROTO;
205205
}
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-
}
216206
}
217207

218208
/* 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);
220210
if (likely(data))
221211
memcpy(to, data, len);
222212
return 0;

0 commit comments

Comments
 (0)