tree: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git nft-bridge5 head: c8d511967c8897a2191b5e9c8695869d2af44bda commit: 3553d2535f25f4593ef29d81e6d18a5ee16d1171 [5/8] net: ipv6: split large skbuff into fragments infrastructure reproduce: # apt-get install sparse git checkout 3553d2535f25f4593ef29d81e6d18a5ee16d1171 make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' sparse warnings: (new ones prefixed by >>) >> net/ipv6/ip6_output.c:755:16: sparse: Using plain integer as NULL pointer net/ipv6/ip6_output.c:1379:24: sparse: expression using sizeof(void) net/ipv6/ip6_output.c:1472:44: sparse: expression using sizeof(void) net/ipv6/ip6_output.c:1611:32: sparse: expression using sizeof(void) net/ipv6/ip6_output.c:1611:32: sparse: expression using sizeof(void) vim +755 net/ipv6/ip6_output.c 682 683 struct sk_buff *ip6_frag_next(struct sk_buff *skb, struct ip6_frag_state *state) 684 { 685 u8 *prevhdr = state->prevhdr, *fragnexthdr_offset; 686 struct sk_buff *frag; 687 struct frag_hdr *fh; 688 unsigned int len; 689 690 len = state->left; 691 /* IF: it doesn't fit, use 'mtu' - the data space left */ 692 if (len > state->mtu) 693 len = state->mtu; 694 /* IF: we are not sending up to and including the packet end 695 then align the next start on an eight byte boundary */ 696 if (len < state->left) 697 len &= ~7; 698 699 /* Allocate buffer */ 700 frag = alloc_skb(len + state->hlen + sizeof(struct frag_hdr) + 701 state->hroom + state->troom, GFP_ATOMIC); 702 if (!frag) 703 return ERR_PTR(-ENOMEM); 704 705 /* 706 * Set up data on packet 707 */ 708 709 ip6_copy_metadata(frag, skb); 710 skb_reserve(frag, state->hroom); 711 skb_put(frag, len + state->hlen + sizeof(struct frag_hdr)); 712 skb_reset_network_header(frag); 713 fh = (struct frag_hdr *)(skb_network_header(frag) + state->hlen); 714 frag->transport_header = (frag->network_header + state->hlen + 715 sizeof(struct frag_hdr)); 716 717 /* 718 * Charge the memory for the fragment to any owner 719 * it might possess 720 */ 721 if (skb->sk) 722 skb_set_owner_w(frag, skb->sk); 723 724 /* 725 * Copy the packet header into the new buffer. 726 */ 727 skb_copy_from_linear_data(skb, skb_network_header(frag), state->hlen); 728 729 fragnexthdr_offset = skb_network_header(frag); 730 fragnexthdr_offset += prevhdr - skb_network_header(skb); 731 *fragnexthdr_offset = NEXTHDR_FRAGMENT; 732 733 /* 734 * Build fragment header. 735 */ 736 fh->nexthdr = state->nexthdr; 737 fh->reserved = 0; 738 fh->identification = state->frag_id; 739 740 /* 741 * Copy a block of the IP datagram. 742 */ 743 BUG_ON(skb_copy_bits(skb, state->ptr, skb_transport_header(frag), 744 len)); 745 state->left -= len; 746 747 fh->frag_off = htons(state->offset); 748 if (state->left > 0) 749 fh->frag_off |= htons(IP6_MF); 750 ipv6_hdr(frag)->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); 751 752 state->ptr += len; 753 state->offset += len; 754 > 755 return 0; 756 } 757 EXPORT_SYMBOL(ip6_frag_next); 758 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation