Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mathias Krause and committed by
David S. Miller
253c6daa 0c7ddf36

+1 -11
+1 -11
net/caif/cfpkt_skbuff.c
··· 203 203 PKT_ERROR(pkt, "cow failed\n"); 204 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 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 210 if (likely(data)) 221 211 memcpy(to, data, len); 222 212 return 0;