From c1c555ef0d582fbfcf122d432316079db21086f7 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Wed, 5 Nov 2003 20:23:45 -0800 Subject: [PATCH] [NET]: Fix skb_copy_expand offset calculation. --- net/core/skbuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0606137440a3e..41bf11447a252 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -595,10 +595,10 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, head_copy_len = skb_headroom(skb); head_copy_off = 0; - if (newheadroom < head_copy_len) { - head_copy_off = head_copy_len - newheadroom; + if (newheadroom <= head_copy_len) head_copy_len = newheadroom; - } + else + head_copy_off = newheadroom - head_copy_len; /* Copy the linear header and data. */ if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off, -- 2.53.0