diff options
Diffstat (limited to 'net/appletalk')
-rw-r--r-- | net/appletalk/ddp.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index f6a92a0b7aa6..16eda21fb38c 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -937,11 +937,11 @@ static unsigned long atalk_sum_partial(const unsigned char *data, | |||
937 | static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, | 937 | static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, |
938 | int len, unsigned long sum) | 938 | int len, unsigned long sum) |
939 | { | 939 | { |
940 | int start = skb_headlen(skb); | 940 | int end = skb_headlen(skb); |
941 | int i, copy; | 941 | int i, copy; |
942 | 942 | ||
943 | /* checksum stuff in header space */ | 943 | /* checksum stuff in header space */ |
944 | if ( (copy = start - offset) > 0) { | 944 | if ((copy = end - offset) > 0) { |
945 | if (copy > len) | 945 | if (copy > len) |
946 | copy = len; | 946 | copy = len; |
947 | sum = atalk_sum_partial(skb->data + offset, copy, sum); | 947 | sum = atalk_sum_partial(skb->data + offset, copy, sum); |
@@ -953,11 +953,9 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, | |||
953 | 953 | ||
954 | /* checksum stuff in frags */ | 954 | /* checksum stuff in frags */ |
955 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 955 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
956 | int end; | 956 | BUG_TRAP(len >= 0); |
957 | 957 | ||
958 | BUG_TRAP(start <= offset + len); | 958 | end = offset + skb_shinfo(skb)->frags[i].size; |
959 | |||
960 | end = start + skb_shinfo(skb)->frags[i].size; | ||
961 | if ((copy = end - offset) > 0) { | 959 | if ((copy = end - offset) > 0) { |
962 | u8 *vaddr; | 960 | u8 *vaddr; |
963 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 961 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
@@ -965,36 +963,31 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, | |||
965 | if (copy > len) | 963 | if (copy > len) |
966 | copy = len; | 964 | copy = len; |
967 | vaddr = kmap_skb_frag(frag); | 965 | vaddr = kmap_skb_frag(frag); |
968 | sum = atalk_sum_partial(vaddr + frag->page_offset + | 966 | sum = atalk_sum_partial(vaddr + frag->page_offset, |
969 | offset - start, copy, sum); | 967 | copy, sum); |
970 | kunmap_skb_frag(vaddr); | 968 | kunmap_skb_frag(vaddr); |
971 | 969 | ||
972 | if (!(len -= copy)) | 970 | if (!(len -= copy)) |
973 | return sum; | 971 | return sum; |
974 | offset += copy; | 972 | offset += copy; |
975 | } | 973 | } |
976 | start = end; | ||
977 | } | 974 | } |
978 | 975 | ||
979 | if (skb_shinfo(skb)->frag_list) { | 976 | if (skb_shinfo(skb)->frag_list) { |
980 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | 977 | struct sk_buff *list = skb_shinfo(skb)->frag_list; |
981 | 978 | ||
982 | for (; list; list = list->next) { | 979 | for (; list; list = list->next) { |
983 | int end; | 980 | BUG_TRAP(len >= 0); |
984 | |||
985 | BUG_TRAP(start <= offset + len); | ||
986 | 981 | ||
987 | end = start + list->len; | 982 | end = offset + list->len; |
988 | if ((copy = end - offset) > 0) { | 983 | if ((copy = end - offset) > 0) { |
989 | if (copy > len) | 984 | if (copy > len) |
990 | copy = len; | 985 | copy = len; |
991 | sum = atalk_sum_skb(list, offset - start, | 986 | sum = atalk_sum_skb(list, 0, copy, sum); |
992 | copy, sum); | ||
993 | if ((len -= copy) == 0) | 987 | if ((len -= copy) == 0) |
994 | return sum; | 988 | return sum; |
995 | offset += copy; | 989 | offset += copy; |
996 | } | 990 | } |
997 | start = end; | ||
998 | } | 991 | } |
999 | } | 992 | } |
1000 | 993 | ||