diff options
Diffstat (limited to 'net/xfrm/xfrm_algo.c')
-rw-r--r-- | net/xfrm/xfrm_algo.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index 6249a9405bb8..be529c4241a6 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c | |||
@@ -532,8 +532,8 @@ EXPORT_SYMBOL_GPL(xfrm_count_enc_supported); | |||
532 | int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, | 532 | int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, |
533 | int offset, int len, icv_update_fn_t icv_update) | 533 | int offset, int len, icv_update_fn_t icv_update) |
534 | { | 534 | { |
535 | int start = skb_headlen(skb); | 535 | int end = skb_headlen(skb); |
536 | int i, copy = start - offset; | 536 | int i, copy = end - offset; |
537 | int err; | 537 | int err; |
538 | struct scatterlist sg; | 538 | struct scatterlist sg; |
539 | 539 | ||
@@ -556,11 +556,9 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, | |||
556 | } | 556 | } |
557 | 557 | ||
558 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 558 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
559 | int end; | 559 | BUG_TRAP(len >= 0); |
560 | 560 | ||
561 | BUG_TRAP(start <= offset + len); | 561 | end = offset + skb_shinfo(skb)->frags[i].size; |
562 | |||
563 | end = start + skb_shinfo(skb)->frags[i].size; | ||
564 | if ((copy = end - offset) > 0) { | 562 | if ((copy = end - offset) > 0) { |
565 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 563 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
566 | 564 | ||
@@ -568,7 +566,7 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, | |||
568 | copy = len; | 566 | copy = len; |
569 | 567 | ||
570 | sg.page = frag->page; | 568 | sg.page = frag->page; |
571 | sg.offset = frag->page_offset + offset-start; | 569 | sg.offset = frag->page_offset; |
572 | sg.length = copy; | 570 | sg.length = copy; |
573 | 571 | ||
574 | err = icv_update(desc, &sg, copy); | 572 | err = icv_update(desc, &sg, copy); |
@@ -579,22 +577,19 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, | |||
579 | return 0; | 577 | return 0; |
580 | offset += copy; | 578 | offset += copy; |
581 | } | 579 | } |
582 | start = end; | ||
583 | } | 580 | } |
584 | 581 | ||
585 | if (skb_shinfo(skb)->frag_list) { | 582 | if (skb_shinfo(skb)->frag_list) { |
586 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | 583 | struct sk_buff *list = skb_shinfo(skb)->frag_list; |
587 | 584 | ||
588 | for (; list; list = list->next) { | 585 | for (; list; list = list->next) { |
589 | int end; | 586 | BUG_TRAP(len >= 0); |
590 | |||
591 | BUG_TRAP(start <= offset + len); | ||
592 | 587 | ||
593 | end = start + list->len; | 588 | end = offset + list->len; |
594 | if ((copy = end - offset) > 0) { | 589 | if ((copy = end - offset) > 0) { |
595 | if (copy > len) | 590 | if (copy > len) |
596 | copy = len; | 591 | copy = len; |
597 | err = skb_icv_walk(list, desc, offset-start, | 592 | err = skb_icv_walk(list, desc, 0, |
598 | copy, icv_update); | 593 | copy, icv_update); |
599 | if (unlikely(err)) | 594 | if (unlikely(err)) |
600 | return err; | 595 | return err; |
@@ -602,7 +597,6 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc, | |||
602 | return 0; | 597 | return 0; |
603 | offset += copy; | 598 | offset += copy; |
604 | } | 599 | } |
605 | start = end; | ||
606 | } | 600 | } |
607 | } | 601 | } |
608 | BUG_ON(len); | 602 | BUG_ON(len); |