[SK_BUFF]: Convert skb->tail to sk_buff_data_t
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 20 Apr 2007 03:29:13 +0000 (20:29 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:26:28 +0000 (22:26 -0700)
So that it is also an offset from skb->head, reduces its size from 8 to 4 bytes
on 64bit architectures, allowing us to combine the 4 bytes hole left by the
layer headers conversion, reducing struct sk_buff size to 256 bytes, i.e. 4
64byte cachelines, and since the sk_buff slab cache is SLAB_HWCACHE_ALIGN...
:-)

Many calculations that previously required that skb->{transport,network,
mac}_header be first converted to a pointer now can be done directly, being
meaningful as offsets or pointers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
110 files changed:
arch/ia64/sn/kernel/xpnet.c
drivers/atm/he.c
drivers/atm/idt77252.c
drivers/atm/nicstar.c
drivers/infiniband/hw/amso1100/c2.c
drivers/isdn/i4l/isdn_net.c
drivers/media/dvb/dvb-core/dvb_net.c
drivers/net/cris/eth_v10.c
drivers/net/cxgb3/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/ibm_emac/ibm_emac_core.c
drivers/net/macb.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/s2io.c
drivers/net/tulip/uli526x.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wireless/hostap/hostap_80211_rx.c
drivers/s390/net/ctcmain.c
drivers/s390/net/netiucv.c
drivers/usb/atm/usbatm.c
drivers/usb/net/asix.c
drivers/usb/net/gl620a.c
drivers/usb/net/net1080.c
drivers/usb/net/rndis_host.c
include/linux/netfilter/nfnetlink.h
include/linux/netlink.h
include/linux/rtnetlink.h
include/linux/skbuff.h
include/net/inet_ecn.h
include/net/netlink.h
include/net/pkt_cls.h
kernel/audit.c
net/atm/lec.c
net/bluetooth/rfcomm/core.c
net/core/dev.c
net/core/filter.c
net/core/gen_stats.c
net/core/pktgen.c
net/core/skbuff.c
net/core/wireless.c
net/decnet/dn_nsp_out.c
net/decnet/dn_route.c
net/decnet/dn_table.c
net/decnet/netfilter/dn_rtmsg.c
net/econet/af_econet.c
net/ieee80211/ieee80211_rx.c
net/ipv4/esp4.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/inet_diag.c
net/ipv4/ip_sockglue.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_ftp.c
net/ipv4/netfilter/arpt_mangle.c
net/ipv4/netfilter/ip_queue.c
net/ipv4/netfilter/nf_nat_helper.c
net/ipv4/tcp.c
net/ipv4/tcp_output.c
net/ipv6/datagram.c
net/ipv6/esp6.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_output.c
net/ipv6/mcast.c
net/ipv6/mip6.c
net/ipv6/ndisc.c
net/ipv6/netfilter/ip6_queue.c
net/ipv6/raw.c
net/irda/ircomm/ircomm_param.c
net/irda/irlan/irlan_common.c
net/irda/qos.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netlink/af_netlink.c
net/packet/af_packet.c
net/sched/act_api.c
net/sched/act_gact.c
net/sched/act_ipt.c
net/sched/act_mirred.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/act_simple.c
net/sched/cls_api.c
net/sched/cls_basic.c
net/sched/cls_fw.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c
net/sched/ematch.c
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_ingress.c
net/sched/sch_netem.c
net/sched/sch_prio.c
net/sched/sch_sfq.c
net/sched/sch_tbf.c
net/sctp/input.c
net/sctp/inqueue.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/tipc/config.c
net/tipc/socket.c
net/xfrm/xfrm_user.c
security/selinux/netlink.c

index 68d59d912c992ac03b222c282171ed79fc5d1e9e..eb416c95967d91ada6cf0fad312b0c23ce0109d8 100644 (file)
@@ -264,7 +264,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg)
 
        dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
                "skb->end=0x%p skb->len=%d\n", (void *) skb->head,
-               (void *) skb->data, (void *) skb->tail, (void *) skb->end,
+               (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end,
                skb->len);
 
        skb->protocol = eth_type_trans(skb, xpnet_device);
@@ -272,7 +272,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg)
 
        dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p "
                "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n",
-               (void *) skb->head, (void *) skb->data, (void *) skb->tail,
+               (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb),
                (void *) skb->end, skb->len);
 
 
@@ -475,7 +475,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
                "skb->end=0x%p skb->len=%d\n", (void *) skb->head,
-               (void *) skb->data, (void *) skb->tail, (void *) skb->end,
+               (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end,
                skb->len);
 
 
@@ -497,7 +497,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        /* get the beginning of the first cacheline and end of last */
        start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1));
-       end_addr = L1_CACHE_ALIGN((u64) skb->tail);
+       end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb));
 
        /* calculate how many bytes to embed in the XPC message */
        embedded_bytes = 0;
@@ -573,7 +573,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                msg->magic = XPNET_MAGIC;
                msg->size = end_addr - start_addr;
                msg->leadin_ignore = (u64) skb->data - start_addr;
-               msg->tailout_ignore = end_addr - (u64) skb->tail;
+               msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
                msg->buf_pa = __pa(start_addr);
 
                dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa="
index 8510026b690a587b175427b1508970e6492f3a5d..d33aba6864c247e34a05f3dd94db131a2c62fc50 100644 (file)
@@ -1901,13 +1901,13 @@ he_service_rbrq(struct he_dev *he_dev, int group)
                        case ATM_AAL0:
                                /* 2.10.1.5 raw cell receive */
                                skb->len = ATM_AAL0_SDU;
-                               skb->tail = skb->data + skb->len;
+                               skb_set_tail_pointer(skb, skb->len);
                                break;
                        case ATM_AAL5:
                                /* 2.10.1.2 aal5 receive */
 
                                skb->len = AAL5_LEN(skb->data, he_vcc->pdu_len);
-                               skb->tail = skb->data + skb->len;
+                               skb_set_tail_pointer(skb, skb->len);
 #ifdef USE_CHECKSUM_HW
                                if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) {
                                        skb->ip_summed = CHECKSUM_COMPLETE;
index b4b80140c3985a25271bc82bd47be24f41893aff..1e49799cd6cf3f4939db7585facf12ed4bd26f77 100644 (file)
@@ -1816,7 +1816,8 @@ push_rx_skb(struct idt77252_dev *card, struct sk_buff *skb, int queue)
        u32 handle;
        u32 addr;
 
-       skb->data = skb->tail = skb->head;
+       skb->data = skb->head;
+       skb_reset_tail_pointer(skb);
        skb->len = 0;
 
        skb_reserve(skb, 16);
index aab9b3733d52197c5d9373dae1310fae01bd436f..26f4b7033494b7dd00933a94b539dfbafbd4c301 100644 (file)
@@ -2208,7 +2208,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
          if (i == 1 && ns_rsqe_eopdu(rsqe))
             *((u32 *) sb->data) |= 0x00000002;
          skb_put(sb, NS_AAL0_HEADER);
-         memcpy(sb->tail, cell, ATM_CELL_PAYLOAD);
+         memcpy(skb_tail_pointer(sb), cell, ATM_CELL_PAYLOAD);
          skb_put(sb, ATM_CELL_PAYLOAD);
          ATM_SKB(sb)->vcc = vcc;
         __net_timestamp(sb);
@@ -2252,7 +2252,8 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
       vc->rx_iov = iovb;
       NS_SKB(iovb)->iovcnt = 0;
       iovb->len = 0;
-      iovb->tail = iovb->data = iovb->head;
+      iovb->data = iovb->head;
+      skb_reset_tail_pointer(iovb);
       NS_SKB(iovb)->vcc = vcc;
       /* IMPORTANT: a pointer to the sk_buff containing the small or large
                     buffer is stored as iovec base, NOT a pointer to the 
@@ -2265,7 +2266,8 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
       recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS);
       NS_SKB(iovb)->iovcnt = 0;
       iovb->len = 0;
-      iovb->tail = iovb->data = iovb->head;
+      iovb->data = iovb->head;
+      skb_reset_tail_pointer(iovb);
       NS_SKB(iovb)->vcc = vcc;
    }
    iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++];
@@ -2489,7 +2491,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
             {
                lb = (struct sk_buff *) iov->iov_base;
                tocopy = min_t(int, remaining, iov->iov_len);
-               memcpy(hb->tail, lb->data, tocopy);
+               memcpy(skb_tail_pointer(hb), lb->data, tocopy);
                skb_put(hb, tocopy);
                iov++;
                remaining -= tocopy;
index 7698feafa6a7b0f0c3307358285f9d70a231a035..58bc272bd407273d18416c00afb35a9e51c086d2 100644 (file)
@@ -439,7 +439,8 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem)
        }
 
        /* Setup the skb for reuse since we're dropping this pkt */
-       elem->skb->tail = elem->skb->data = elem->skb->head;
+       elem->skb->data = elem->skb->head;
+       skb_reset_tail_pointer(elem->skb);
 
        /* Zero out the rxp hdr in the sk_buff */
        memset(elem->skb->data, 0, sizeof(*rxp_hdr));
@@ -521,7 +522,7 @@ static void c2_rx_interrupt(struct net_device *netdev)
                 * "sizeof(struct c2_rxp_hdr)".
                 */
                skb->data += sizeof(*rxp_hdr);
-               skb->tail = skb->data + buflen;
+               skb_set_tail_pointer(skb, buflen);
                skb->len = buflen;
                skb->protocol = eth_type_trans(skb, netdev);
 
index cd3b1fa4a4140735511814f0354fea1fbb5b749f..aa83277aba74c78c011e3b071ba5df7c067b165d 100644 (file)
@@ -881,7 +881,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
 
        addinfo[0] = '\0';
        /* This check stolen from 2.1.72 dev_queue_xmit_nit() */
-       if (p < skb->data || p >= skb->tail) {
+       if (p < skb->data || skb->network_header >= skb->tail) {
                /* fall back to old isdn_net_log_packet method() */
                char * buf = skb->data;
 
index c6b004182d912ccbf81326c0c16da24b15e3a3b7..9de177a5b9f1ba615d8d478c90540134ac8d9d11 100644 (file)
@@ -600,6 +600,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                        /* Check CRC32, we've got it in our skb already. */
                        unsigned short ulen = htons(priv->ule_sndu_len);
                        unsigned short utype = htons(priv->ule_sndu_type);
+                       const u8 *tail;
                        struct kvec iov[3] = {
                                { &ulen, sizeof ulen },
                                { &utype, sizeof utype },
@@ -613,10 +614,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                        }
 
                        ule_crc = iov_crc32(ule_crc, iov, 3);
-                       expected_crc = *((u8 *)priv->ule_skb->tail - 4) << 24 |
-                                      *((u8 *)priv->ule_skb->tail - 3) << 16 |
-                                      *((u8 *)priv->ule_skb->tail - 2) << 8 |
-                                      *((u8 *)priv->ule_skb->tail - 1);
+                       tail = skb_tail_pointer(priv->ule_skb);
+                       expected_crc = *(tail - 4) << 24 |
+                                      *(tail - 3) << 16 |
+                                      *(tail - 2) << 8 |
+                                      *(tail - 1);
                        if (ule_crc != expected_crc) {
                                printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n",
                                       priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0);
index 98643801a3b079d1351e2641d3a88fd5a55464fd..7feb9c5611471dc47f764e8e9c5dc641262b1b68 100644 (file)
@@ -1348,7 +1348,7 @@ e100_rx(struct net_device *dev)
 
 #ifdef ETHDEBUG
                printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n",
-                 skb->head, skb->data, skb->tail, skb->end);
+                 skb->head, skb->data, skb_tail_pointer(skb), skb->end);
                printk("copying packet to 0x%x.\n", skb_data_ptr);
 #endif
 
index 610e4769efa463c3172f9f574af9d578391e4587..c5faf1380e15c8a0214e0592f1fbde47947f5fc0 100644 (file)
@@ -1325,13 +1325,13 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
        flits = skb_transport_offset(skb) / 8;
        sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
        sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
-                            skb->tail - skb_transport_header(skb),
+                            skb->tail - skb->transport_header,
                             adap->pdev);
        if (need_skb_unmap()) {
                setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
                skb->destructor = deferred_unmap_destructor;
                ((struct unmap_info *)skb->cb)->len = (skb->tail -
-                                                      skb_transport_header(skb));
+                                                      skb->transport_header);
        }
 
        write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits,
@@ -1353,7 +1353,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
                return 1;       /* packet fits as immediate data */
 
        flits = skb_transport_offset(skb) / 8;  /* headers */
-       if (skb->tail != skb_transport_header(skb))
+       if (skb->tail != skb->transport_header)
                cnt++;
        return flits_to_desc(flits + sgl_len(cnt));
 }
index e86deb2ef823c40a8ec1c2e9f52fc21984d1b6c3..e7c93f44f810ffbf16c3d5674de0ff2722997c61 100644 (file)
@@ -3304,7 +3304,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                                 * NOTE: this is a TSO only workaround
                                 * if end byte alignment not correct move us
                                 * into the next dword */
-                               if ((unsigned long)(skb->tail - 1) & 4)
+                               if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4)
                                        break;
                                /* fall through */
                        case e1000_82571:
@@ -4388,7 +4388,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                                PCI_DMA_FROMDEVICE);
                        vaddr = kmap_atomic(ps_page->ps_page[0],
                                            KM_SKB_DATA_SOFTIRQ);
-                       memcpy(skb->tail, vaddr, l1);
+                       memcpy(skb_tail_pointer(skb), vaddr, l1);
                        kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
                        pci_dma_sync_single_for_device(pdev,
                                ps_page_dma->ps_page_dma[0],
index b1ad62d89eb982cb525b2358227e7bf98f595ca5..3d82d46f4998f7d5494c315fdd15a54426c83dd9 100644 (file)
@@ -1338,7 +1338,7 @@ static inline int emac_rx_sg_append(struct ocp_enet_private *dev, int slot)
                        dev_kfree_skb(dev->rx_sg_skb);
                        dev->rx_sg_skb = NULL;
                } else {
-                       cacheable_memcpy(dev->rx_sg_skb->tail,
+                       cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb),
                                         dev->rx_skb[slot]->data, len);
                        skb_put(dev->rx_sg_skb, len);
                        emac_recycle_rx_skb(dev, slot, len);
index 0c3649be0d05d5eafa3fbf20b1a40a8ef58315b8..98bf51afcee71cd72d6ed505e4f599799cd1078b 100644 (file)
@@ -575,7 +575,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
        int i;
        dev_dbg(&bp->pdev->dev,
                "start_xmit: len %u head %p data %p tail %p end %p\n",
-               skb->len, skb->head, skb->data, skb->tail, skb->end);
+               skb->len, skb->head, skb->data,
+               skb_tail_pointer(skb), skb->end);
        dev_dbg(&bp->pdev->dev,
                "data:");
        for (i = 0; i < 16; i++)
index ec0af65cd5d761ab960040d7acf72c446de2f1af..73da611fd536b18d93b5f44ecd90602892a98bc0 100644 (file)
@@ -1185,7 +1185,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
        skb_reserve(skb, 2);
        insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1);
        if (pkt_len & 1)
-           *(skb->tail-1) = inb(ioaddr + AM2150_RCV);
+           *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV);
        skb->protocol = eth_type_trans(skb, dev);
        
        netif_rx(skb); /* Send the packet to the upper (protocol) layers. */
index 46ebf141ee5a15b62d0c16eeb77b86dc939a31a9..600d3ff347fc83229cf7cbbb49fe4aa8e3810491 100644 (file)
@@ -2195,7 +2195,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \
        frag_list->next = NULL;
        tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
        frag_list->data = tmp;
-       frag_list->tail = tmp;
+       skb_reset_tail_pointer(frag_list);
 
        /* Buffer-2 receives L4 data payload */
        ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev,
@@ -2349,7 +2349,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                        tmp += ALIGN_SIZE;
                        tmp &= ~ALIGN_SIZE;
                        skb->data = (void *) (unsigned long)tmp;
-                       skb->tail = (void *) (unsigned long)tmp;
+                       skb_reset_tail_pointer(skb);
 
                        if (!(((struct RxD3*)rxdp)->Buffer0_ptr))
                                ((struct RxD3*)rxdp)->Buffer0_ptr =
index 9a5850fa644abdeae1f7851fb68153f014ea9c5a..e46f4cb02c152fa15d73f2abdfd4ee894f1ab423 100644 (file)
@@ -829,7 +829,9 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
                                        != NULL) ) {
                                        /* size less than COPY_SIZE, allocate a rxlen SKB */
                                        skb_reserve(skb, 2); /* 16byte align */
-                                       memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen);
+                                       memcpy(skb_put(skb, rxlen),
+                                              skb_tail_pointer(rxptr->rx_skb_ptr),
+                                              rxlen);
                                        uli526x_reuse_skb(db, rxptr->rx_skb_ptr);
                                } else
                                        skb_put(skb, rxlen);
@@ -1175,7 +1177,10 @@ static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * sk
 
        if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) {
                rxptr->rx_skb_ptr = skb;
-               rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
+               rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev,
+                                                         skb_tail_pointer(skb),
+                                                         RX_ALLOC_SIZE,
+                                                         PCI_DMA_FROMDEVICE));
                wmb();
                rxptr->rdes0 = cpu_to_le32(0x80000000);
                db->rx_avail_cnt++;
@@ -1339,7 +1344,10 @@ static void allocate_rx_buffer(struct uli526x_board_info *db)
                if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL )
                        break;
                rxptr->rx_skb_ptr = skb; /* FIXME (?) */
-               rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
+               rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev,
+                                                         skb_tail_pointer(skb),
+                                                         RX_ALLOC_SIZE,
+                                                         PCI_DMA_FROMDEVICE));
                wmb();
                rxptr->rdes0 = cpu_to_le32(0x80000000);
                rxptr = rxptr->next_rx_desc;
index b747228c719898e0e3e5d73ae0b580ffe3e22bc6..aeb2789adf264f8c8126ececc7bed28e5ee37628 100644 (file)
@@ -533,7 +533,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
                skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI);
                fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI);
        }
-       data = skb->tail;
+       data = skb_tail_pointer(skb);
        data[i++] = LMI_CALLREF;
        data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY;
        if (lmi == LMI_ANSI)
index d4851465c83b3a9c5af6beb122cbe29e8e6611ff..b731f3aae0df897d5dad5c62be86605d9ffc871b 100644 (file)
@@ -1636,7 +1636,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
             if (nsb) {
                 sc->lmc_rxq[i] = nsb;
                 nsb->dev = dev;
-                sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail);
+                sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb));
             }
             sc->failed_recv_alloc = 1;
             goto skip_packet;
@@ -1679,7 +1679,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
             if (nsb) {
                 sc->lmc_rxq[i] = nsb;
                 nsb->dev = dev;
-                sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail);
+                sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb));
                 /* Transferred to 21140 below */
             }
             else {
index 35a3a50724fee1c44036fc3d95bfa6281147cdc4..5e3e9e2627069fcbb103f23e5753bd9c7c53a5bf 100644 (file)
@@ -922,7 +922,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
                if (frag != 0)
                        flen -= hdrlen;
 
-               if (frag_skb->tail + flen > frag_skb->end) {
+               if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) {
                        printk(KERN_WARNING "%s: host decrypted and "
                               "reassembled frame did not fit skb\n",
                               dev->name);
index 787c01317042fece3bc3ef5b1624a6bbb44e76ae..54e3f806cd52e925fee5772ad875f1e771a14ccd 100644 (file)
@@ -706,7 +706,8 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
                        spin_unlock(&ch->collect_lock);
                        return;
                }
-               ch->trans_skb->tail = ch->trans_skb->data = ch->trans_skb_data;
+               ch->trans_skb->data = ch->trans_skb_data;
+               skb_reset_tail_pointer(ch->trans_skb);
                ch->trans_skb->len = 0;
                if (ch->prof.maxmulti < (ch->collect_len + 2))
                        ch->prof.maxmulti = ch->collect_len + 2;
@@ -831,7 +832,8 @@ ch_action_rx(fsm_instance * fi, int event, void *arg)
                ctc_unpack_skb(ch, skb);
        }
  again:
-       skb->data = skb->tail = ch->trans_skb_data;
+       skb->data = ch->trans_skb_data;
+       skb_reset_tail_pointer(skb);
        skb->len = 0;
        if (ctc_checkalloc_buffer(ch, 1))
                return;
@@ -2226,7 +2228,8 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
                 * IDAL support in CTC is broken, so we have to
                 * care about skb's above 2G ourselves.
                 */
-               hi = ((unsigned long) skb->tail + LL_HEADER_LENGTH) >> 31;
+               hi = ((unsigned long)skb_tail_pointer(skb) +
+                     LL_HEADER_LENGTH) >> 31;
                if (hi) {
                        nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
                        if (!nskb) {
@@ -2262,7 +2265,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
                                return -EBUSY;
                        }
 
-                       ch->trans_skb->tail = ch->trans_skb->data;
+                       skb_reset_tail_pointer(ch->trans_skb);
                        ch->trans_skb->len = 0;
                        ch->ccw[1].count = skb->len;
                        memcpy(skb_put(ch->trans_skb, skb->len), skb->data,
index 82edf2014402a8fbadf0249aec259c600a5e666b..cd42bd54988cd9645de2fcc902e8ea5274b80e14 100644 (file)
@@ -689,7 +689,8 @@ static void conn_action_rx(fsm_instance *fi, int event, void *arg)
                               msg->length, conn->max_buffsize);
                return;
        }
-       conn->rx_buff->data = conn->rx_buff->tail = conn->rx_buff->head;
+       conn->rx_buff->data = conn->rx_buff->head;
+       skb_reset_tail_pointer(conn->rx_buff);
        conn->rx_buff->len = 0;
        rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data,
                                  msg->length, NULL);
@@ -735,7 +736,8 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)
                        }
                }
        }
-       conn->tx_buff->data = conn->tx_buff->tail = conn->tx_buff->head;
+       conn->tx_buff->data = conn->tx_buff->head;
+       skb_reset_tail_pointer(conn->tx_buff);
        conn->tx_buff->len = 0;
        spin_lock_irqsave(&conn->collect_lock, saveflags);
        while ((skb = skb_dequeue(&conn->collect_queue))) {
@@ -1164,8 +1166,8 @@ static int netiucv_transmit_skb(struct iucv_connection *conn,
                 * Copy the skb to a new allocated skb in lowmem only if the
                 * data is located above 2G in memory or tailroom is < 2.
                 */
-               unsigned long hi =
-                       ((unsigned long)(skb->tail + NETIUCV_HDRLEN)) >> 31;
+               unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) +
+                                   NETIUCV_HDRLEN)) >> 31;
                int copied = 0;
                if (hi || (skb_tailroom(skb) < 2)) {
                        nskb = alloc_skb(skb->len + NETIUCV_HDRLEN +
index ec63b0ee07437312f8c9abc6a4f3dfbe057d7d70..4d8f282b23d1408765d628100f7e8f5ad7a9981c 100644 (file)
@@ -335,15 +335,15 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
 
        sarb = instance->cached_vcc->sarb;
 
-       if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) {
+       if (skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD > sarb->end) {
                atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n",
                                __func__, sarb->len, vcc);
                /* discard cells already received */
                skb_trim(sarb, 0);
-               UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
+               UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end);
        }
 
-       memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
+       memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
        __skb_put(sarb, ATM_CELL_PAYLOAD);
 
        if (pti & 1) {
@@ -370,7 +370,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
                        goto out;
                }
 
-               if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) {
+               if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) {
                        atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n",
                                  __func__, vcc);
                        atomic_inc(&vcc->stats->rx_err);
@@ -396,7 +396,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
                        goto out;       /* atm_charge increments rx_drop */
                }
 
-               memcpy(skb->data, sarb->tail - pdu_length, length);
+               memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length);
                __skb_put(skb, length);
 
                vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u",
index 5808ea0824594adad543d4ac90fa13488c7903fb..f56e2dab3712d2115565102b1089283d022efc9f 100644 (file)
@@ -298,7 +298,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
                if (ax_skb) {
                        ax_skb->len = size;
                        ax_skb->data = packet;
-                       ax_skb->tail = packet + size;
+                       skb_set_tail_pointer(ax_skb, size);
                        usbnet_skb_return(dev, ax_skb);
                } else {
                        return 0;
@@ -338,7 +338,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
            && ((headroom + tailroom) >= (4 + padlen))) {
                if ((headroom < 4) || (tailroom < padlen)) {
                        skb->data = memmove(skb->head + 4, skb->data, skb->len);
-                       skb->tail = skb->data + skb->len;
+                       skb_set_tail_pointer(skb, skb->len);
                }
        } else {
                struct sk_buff *skb2;
@@ -356,7 +356,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 
        if ((skb->len % 512) == 0) {
                cpu_to_le32s(&padbytes);
-               memcpy( skb->tail, &padbytes, sizeof(padbytes));
+               memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
                skb_put(skb, sizeof(padbytes));
        }
        return skb;
index d257a8e026d6182b77fea025a60376eb842b063b..031cf5ca4dbb1eddb846665e4606f290eec863fc 100644 (file)
@@ -157,7 +157,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
                if ((headroom < (4 + 4*1)) || (tailroom < padlen)) {
                        skb->data = memmove(skb->head + (4 + 4*1),
                                             skb->data, skb->len);
-                       skb->tail = skb->data + skb->len;
+                       skb_set_tail_pointer(skb, skb->len);
                }
        } else {
                struct sk_buff  *skb2;
index ccebfdef4751f945f7577d7097f9c4540b8b4eb9..19bf8dae70c9ddb3081fdec476b2757c4bc1000a 100644 (file)
@@ -520,7 +520,7 @@ net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
                        skb->data = memmove(skb->head
                                                + sizeof (struct nc_header),
                                            skb->data, skb->len);
-                       skb->tail = skb->data + len;
+                       skb_set_tail_pointer(skb, len);
                        goto encapsulate;
                }
        }
index 39a21c74fdf4af34e900900e8ab01fb3d0666df7..1d36772ba6e178b76f57258c2d2eeac5bc971512 100644 (file)
@@ -588,7 +588,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
                if (likely((sizeof *hdr) <= room)) {
                        skb->data = memmove(skb->head + sizeof *hdr,
                                            skb->data, len);
-                       skb->tail = skb->data + len;
+                       skb_set_tail_pointer(skb, len);
                        goto fill;
                }
        }
index 6179648a014ea1d77330a9b3121f7f9737386bd4..e1ea5dfbbbd44550656641c79eb214d932d06407 100644 (file)
@@ -62,11 +62,11 @@ struct nfattr
 #define NFA_DATA(nfa)   ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
 #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
 #define NFA_NEST(skb, type) \
-({     struct nfattr *__start = (struct nfattr *) (skb)->tail; \
+({     struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
        NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
        __start;  })
 #define NFA_NEST_END(skb, start) \
-({      (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \
+({      (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
         (skb)->len; })
 #define NFA_NEST_CANCEL(skb, start) \
 ({      if (start) \
index a9d3ad5bc80f3991e0ea021be70e75d1572ab708..68a632b372ecfb7b12178c38d8dbdbf8e05e6b71 100644 (file)
@@ -229,7 +229,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
                  (cb)->nlh->nlmsg_seq, type, len, flags)
 
 #define NLMSG_END(skb, nlh) \
-({     (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
+({     (nlh)->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)(nlh); \
        (skb)->len; })
 
 #define NLMSG_CANCEL(skb, nlh) \
index 4a629ea70cc4ca60a6f486f8653974af68dbe8cd..3a4cb242ecd235850c7034d824a5559dac066a67 100644 (file)
@@ -605,7 +605,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
 
 #define RTA_PUT_NOHDR(skb, attrlen, data) \
 ({     RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
-       memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \
+       memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
               RTA_ALIGN(attrlen) - attrlen); })
 
 #define RTA_PUT_U8(skb, attrtype, value) \
@@ -637,12 +637,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
        RTA_PUT(skb, attrtype, 0, NULL);
 
 #define RTA_NEST(skb, type) \
-({     struct rtattr *__start = (struct rtattr *) (skb)->tail; \
+({     struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
        RTA_PUT(skb, type, 0, NULL); \
        __start;  })
 
 #define RTA_NEST_END(skb, start) \
-({     (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \
+({     (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
        (skb)->len; })
 
 #define RTA_NEST_CANCEL(skb, start) \
index 2e740550062615f559387c122518f943f07899b6..e1c2392ecb565ba76803140a5693c1ca8ced3151 100644 (file)
@@ -246,9 +246,6 @@ struct sk_buff {
        int                     iif;
        /* 4 byte hole on 64 bit*/
 
-       sk_buff_data_t          transport_header;
-       sk_buff_data_t          network_header;
-       sk_buff_data_t          mac_header;
        struct  dst_entry       *dst;
        struct  sec_path        *sp;
 
@@ -303,13 +300,16 @@ struct sk_buff {
 
        __u32                   mark;
 
+       sk_buff_data_t          transport_header;
+       sk_buff_data_t          network_header;
+       sk_buff_data_t          mac_header;
        /* These elements must be at the end, see alloc_skb() for details.  */
-       unsigned int            truesize;
-       atomic_t                users;
+       sk_buff_data_t          tail;
        unsigned char           *head,
                                *data,
-                               *tail,
                                *end;
+       unsigned int            truesize;
+       atomic_t                users;
 };
 
 #ifdef __KERNEL__
@@ -812,12 +812,45 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
 #define SKB_FRAG_ASSERT(skb)   BUG_ON(skb_shinfo(skb)->frag_list)
 #define SKB_LINEAR_ASSERT(skb)  BUG_ON(skb_is_nonlinear(skb))
 
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
+{
+       return skb->head + skb->tail;
+}
+
+static inline void skb_reset_tail_pointer(struct sk_buff *skb)
+{
+       skb->tail = skb->data - skb->head;
+}
+
+static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
+{
+       skb_reset_tail_pointer(skb);
+       skb->tail += offset;
+}
+#else /* NET_SKBUFF_DATA_USES_OFFSET */
+static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
+{
+       return skb->tail;
+}
+
+static inline void skb_reset_tail_pointer(struct sk_buff *skb)
+{
+       skb->tail = skb->data;
+}
+
+static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
+{
+       skb->tail = skb->data + offset;
+}
+#endif /* NET_SKBUFF_DATA_USES_OFFSET */
+
 /*
  *     Add data to an sk_buff
  */
 static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
 {
-       unsigned char *tmp = skb->tail;
+       unsigned char *tmp = skb_tail_pointer(skb);
        SKB_LINEAR_ASSERT(skb);
        skb->tail += len;
        skb->len  += len;
@@ -835,11 +868,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
  */
 static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
 {
-       unsigned char *tmp = skb->tail;
+       unsigned char *tmp = skb_tail_pointer(skb);
        SKB_LINEAR_ASSERT(skb);
        skb->tail += len;
        skb->len  += len;
-       if (unlikely(skb->tail>skb->end))
+       if (unlikely(skb_tail_pointer(skb) > skb->end))
                skb_over_panic(skb, len, current_text_addr());
        return tmp;
 }
@@ -935,7 +968,7 @@ static inline int skb_headroom(const struct sk_buff *skb)
  */
 static inline int skb_tailroom(const struct sk_buff *skb)
 {
-       return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
+       return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb);
 }
 
 /**
@@ -1127,8 +1160,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
                WARN_ON(1);
                return;
        }
-       skb->len  = len;
-       skb->tail = skb->data + len;
+       skb->len = len;
+       skb_set_tail_pointer(skb, len);
 }
 
 /**
index 06a2c69a89e5f4706f826737745ee82f60dad156..de8399a797749007f17501f8371136fb83d33fd1 100644 (file)
@@ -114,14 +114,12 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
 {
        switch (skb->protocol) {
        case __constant_htons(ETH_P_IP):
-               if (skb_network_header(skb) + sizeof(struct iphdr) <=
-                   skb->tail)
+               if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
                        return IP_ECN_set_ce(ip_hdr(skb));
                break;
 
        case __constant_htons(ETH_P_IPV6):
-               if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
-                   skb->tail)
+               if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
                        return IP6_ECN_set_ce(ipv6_hdr(skb));
                break;
        }
index bcaf67b7a19d131022d0f41f61d5c2e838a8a56b..2c7ab107f20d4d27e48253e51020b4e63781f4c2 100644 (file)
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
  */
 static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
-       nlh->nlmsg_len = skb->tail - (unsigned char *) nlh;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh;
 
        return skb->len;
 }
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
  */
 static inline void *nlmsg_get_pos(struct sk_buff *skb)
 {
-       return skb->tail;
+       return skb_tail_pointer(skb);
 }
 
 /**
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla)
  */
 static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
 {
-       struct nlattr *start = (struct nlattr *) skb->tail;
+       struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
 
        if (nla_put(skb, attrtype, 0, NULL) < 0)
                return NULL;
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
  */
 static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
 {
-       start->nla_len = skb->tail - (unsigned char *) start;
+       start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
        return skb->len;
 }
 
index dcb3a91f136434975386011eb1bbf86b10e43c47..4129df7080797bb665bdd5213f2c1254cad33f47 100644 (file)
@@ -337,7 +337,7 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
 static inline int tcf_valid_offset(const struct sk_buff *skb,
                                   const unsigned char *ptr, const int len)
 {
-       return unlikely((ptr + len) < skb->tail && ptr > skb->head);
+       return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head);
 }
 
 #ifdef CONFIG_NET_CLS_IND
index 76c9a11b72d64c738402159b55a39012fee6142b..ea8521417d1363a52a6d88b58d6fbd20f3b14dee 100644 (file)
@@ -1073,7 +1073,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt,
                        goto out;
        }
        va_copy(args2, args);
-       len = vsnprintf(skb->tail, avail, fmt, args);
+       len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args);
        if (len >= avail) {
                /* The printk buffer is 1024 bytes long, so if we get
                 * here and AUDIT_BUFSIZ is at least 1024, then we can
@@ -1082,7 +1082,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt,
                        max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail));
                if (!avail)
                        goto out;
-               len = vsnprintf(skb->tail, avail, fmt, args2);
+               len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2);
        }
        if (len > 0)
                skb_put(skb, len);
@@ -1143,7 +1143,7 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf,
                        return;
        }
 
-       ptr = skb->tail;
+       ptr = skb_tail_pointer(skb);
        for (i=0; i<len; i++) {
                *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */
                *ptr++ = hex[buf[i] & 0x0F];      /* Lower nibble */
@@ -1175,7 +1175,7 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen,
                if (!avail)
                        return;
        }
-       ptr = skb->tail;
+       ptr = skb_tail_pointer(skb);
        *ptr++ = '"';
        memcpy(ptr, string, slen);
        ptr += slen;
index d339645dc796927ae5b5abbe2a4edf9489bf087b..a8c6b285e06c96f53b723979fdf5cc0723ffbf37 100644 (file)
@@ -283,7 +283,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n",
-               (long)skb->head, (long)skb->data, (long)skb->tail,
+               (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb),
                (long)skb->end);
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
        if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0)
index 94f45736056085a901c78f7208781e67d465602c..10cc13cfae6c8b32b0cb2f1cbb4165c7cd28838a 100644 (file)
@@ -1567,7 +1567,7 @@ static int rfcomm_recv_frame(struct rfcomm_session *s, struct sk_buff *skb)
 
        /* Trim FCS */
        skb->len--; skb->tail--;
-       fcs = *(u8 *) skb->tail;
+       fcs = *(u8 *)skb_tail_pointer(skb);
 
        if (__check_fcs(skb->data, type, fcs)) {
                BT_ERR("bad checksum in packet");
index 6562e5736e2f875933e0435a9e6a912647e4402d..86dc9f693f66f9987f7eb5ca75a391ccf4718ca8 100644 (file)
@@ -1069,7 +1069,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
                        skb_reset_mac_header(skb2);
 
                        if (skb_network_header(skb2) < skb2->data ||
-                           skb_network_header(skb2) > skb2->tail) {
+                           skb2->network_header > skb2->tail) {
                                if (net_ratelimit())
                                        printk(KERN_CRIT "protocol %04x is "
                                               "buggy, dev %s\n",
@@ -1175,7 +1175,7 @@ int skb_checksum_help(struct sk_buff *skb)
        BUG_ON(offset > (int)skb->len);
        csum = skb_checksum(skb, offset, skb->len-offset, 0);
 
-       offset = skb->tail - skb_transport_header(skb);
+       offset = skb->tail - skb->transport_header;
        BUG_ON(offset <= 0);
        BUG_ON(skb->csum_offset + 2 > offset);
 
index d2358a5e63390309f45039b535df87f709700692..bd903aaf7aa74fb871f4f4cdda14c6cd55755ee5 100644 (file)
@@ -46,7 +46,7 @@ static void *__load_pointer(struct sk_buff *skb, int k)
        else if (k >= SKF_LL_OFF)
                ptr = skb_mac_header(skb) + k - SKF_LL_OFF;
 
-       if (ptr >= skb->head && ptr < skb->tail)
+       if (ptr >= skb->head && ptr < skb_tail_pointer(skb))
                return ptr;
        return NULL;
 }
index 259473d0559d1ed713887c6a21f90181a1a1c5a5..bcc25591d8ac554c898bbf0a47573ad6705d5934 100644 (file)
@@ -61,7 +61,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
        spin_lock_bh(lock);
        d->lock = lock;
        if (type)
-               d->tail = (struct rtattr *) skb->tail;
+               d->tail = (struct rtattr *)skb_tail_pointer(skb);
        d->skb = skb;
        d->compat_tc_stats = tc_stats_type;
        d->compat_xstats = xstats_type;
@@ -212,7 +212,7 @@ int
 gnet_stats_finish_copy(struct gnet_dump *d)
 {
        if (d->tail)
-               d->tail->rta_len = d->skb->tail - (u8 *) d->tail;
+               d->tail->rta_len = skb_tail_pointer(d->skb) - (u8 *)d->tail;
 
        if (d->compat_tc_stats)
                if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,
index 9da8357addcdb1f4618f16d4483d0e168b9f1cd3..f9469ea530cc429bc51965563653e333ac175e9a 100644 (file)
@@ -2357,7 +2357,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
                *vlan_encapsulated_proto = htons(ETH_P_IP);
        }
 
-       skb_set_network_header(skb, skb->tail - skb->data);
+       skb->network_header = skb->tail;
        skb->transport_header = skb->network_header + sizeof(struct iphdr);
        skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr));
 
@@ -2696,7 +2696,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
                *vlan_encapsulated_proto = htons(ETH_P_IPV6);
        }
 
-       skb_set_network_header(skb, skb->tail - skb->data);
+       skb->network_header = skb->tail;
        skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
        skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr));
 
index a48b086812615cb2534231e52717c4fe560e4e6c..ddcbc4d10dabf4918d2554913c10479736c95cf5 100644 (file)
@@ -87,8 +87,9 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
 void skb_over_panic(struct sk_buff *skb, int sz, void *here)
 {
        printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
-                         "data:%p tail:%p end:%p dev:%s\n",
-              here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
+                         "data:%p tail:%#lx end:%p dev:%s\n",
+              here, skb->len, sz, skb->head, skb->data,
+              (unsigned long)skb->tail, skb->end,
               skb->dev ? skb->dev->name : "<NULL>");
        BUG();
 }
@@ -105,8 +106,9 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here)
 void skb_under_panic(struct sk_buff *skb, int sz, void *here)
 {
        printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
-                         "data:%p tail:%p end:%p dev:%s\n",
-              here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
+                         "data:%p tail:%#lx end:%p dev:%s\n",
+              here, skb->len, sz, skb->head, skb->data,
+              (unsigned long)skb->tail, skb->end,
               skb->dev ? skb->dev->name : "<NULL>");
        BUG();
 }
@@ -167,7 +169,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
        atomic_set(&skb->users, 1);
        skb->head = data;
        skb->data = data;
-       skb->tail = data;
+       skb_reset_tail_pointer(skb);
        skb->end  = data + size;
        /* make sure we initialize shinfo sequentially */
        shinfo = skb_shinfo(skb);
@@ -629,7 +631,12 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
 
        /* Copy only real data... and, alas, header. This should be
         * optimized for the cases when header is void. */
-       memcpy(data + nhead, skb->head, skb->tail - skb->head);
+       memcpy(data + nhead, skb->head,
+               skb->tail
+#ifndef NET_SKBUFF_DATA_USES_OFFSET
+               - skb->head
+#endif
+               );
        memcpy(data + size, skb->end, sizeof(struct skb_shared_info));
 
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
@@ -645,9 +652,9 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
        skb->head     = data;
        skb->end      = data + size;
        skb->data    += off;
-       skb->tail    += off;
 #ifndef NET_SKBUFF_DATA_USES_OFFSET
-       /* {transport,network,mac}_header are relative to skb->head */
+       /* {transport,network,mac}_header and tail are relative to skb->head */
+       skb->tail             += off;
        skb->transport_header += off;
        skb->network_header   += off;
        skb->mac_header       += off;
@@ -762,7 +769,7 @@ int skb_pad(struct sk_buff *skb, int pad)
                return 0;
        }
 
-       ntail = skb->data_len + pad - (skb->end - skb->tail);
+       ntail = skb->data_len + pad - (skb->end - skb_tail_pointer(skb));
        if (likely(skb_cloned(skb) || ntail > 0)) {
                err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC);
                if (unlikely(err))
@@ -863,7 +870,7 @@ done:
        } else {
                skb->len       = len;
                skb->data_len  = 0;
-               skb->tail      = skb->data + len;
+               skb_set_tail_pointer(skb, len);
        }
 
        return 0;
@@ -900,7 +907,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
         * plus 128 bytes for future expansions. If we have enough
         * room at tail, reallocate without expansion only if skb is cloned.
         */
-       int i, k, eat = (skb->tail + delta) - skb->end;
+       int i, k, eat = (skb_tail_pointer(skb) + delta) - skb->end;
 
        if (eat > 0 || skb_cloned(skb)) {
                if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
@@ -908,7 +915,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
                        return NULL;
        }
 
-       if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta))
+       if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
                BUG();
 
        /* Optimization: no fragments, no reasons to preestimate
@@ -1004,7 +1011,7 @@ pull_pages:
        skb->tail     += delta;
        skb->data_len -= delta;
 
-       return skb->tail;
+       return skb_tail_pointer(skb);
 }
 
 /* Copy some data bits from skb to kernel buffer. */
@@ -1539,7 +1546,7 @@ static inline void skb_split_inside_header(struct sk_buff *skb,
        skb1->len                  += skb1->data_len;
        skb->data_len              = 0;
        skb->len                   = len;
-       skb->tail                  = skb->data + len;
+       skb_set_tail_pointer(skb, len);
 }
 
 static inline void skb_split_no_header(struct sk_buff *skb,
index 7c6a5db544f1c0e12ca279cc94683b7427c750b4..4a777b68e3bce26089693b1bff39047bad55514e 100644 (file)
@@ -1938,7 +1938,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff *  skb,
 {
        struct ifinfomsg *r;
        struct nlmsghdr  *nlh;
-       unsigned char    *b = skb->tail;
+       unsigned char    *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r));
        r = NLMSG_DATA(nlh);
@@ -1952,7 +1952,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff *  skb,
        /* Add the wireless events in the netlink packet */
        RTA_PUT(skb, IFLA_WIRELESS, event_len, event);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
index 84b8c5b45fefe0f7f15940ca0ee094145104579e..7404653880b061c9ea8cb35bd10d63bf0b5a677e 100644 (file)
@@ -681,8 +681,10 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
        if (scp->peer.sdn_objnum)
                type = 0;
 
-       skb_put(skb, dn_sockaddr2username(&scp->peer, skb->tail, type));
-       skb_put(skb, dn_sockaddr2username(&scp->addr, skb->tail, 2));
+       skb_put(skb, dn_sockaddr2username(&scp->peer,
+                                         skb_tail_pointer(skb), type));
+       skb_put(skb, dn_sockaddr2username(&scp->addr,
+                                         skb_tail_pointer(skb), 2));
 
        menuver = DN_MENUVER_ACC | DN_MENUVER_USR;
        if (scp->peer.sdn_flags & SDF_PROXY)
index bb73bf16630f5f27889c913715eb2ed8564d224d..9678b096b844bf51a0518c5c822b64d66e69f187 100644 (file)
@@ -1468,7 +1468,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        struct dn_route *rt = (struct dn_route *)skb->dst;
        struct rtmsg *r;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        long expires;
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
@@ -1509,7 +1509,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        if (rt->fl.iif)
                RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
index 780a141f8342c93c880b53245cbddaa2103cdc7b..544c455407460eb4c465d68f9113ab4f7f87c6ee 100644 (file)
@@ -295,7 +295,7 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
 {
        struct rtmsg *rtm;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags);
        rtm = NLMSG_DATA(nlh);
@@ -337,13 +337,13 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                        nhp->rtnh_ifindex = nh->nh_oif;
                        if (nh->nh_gw)
                                RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw);
-                       nhp->rtnh_len = skb->tail - (unsigned char *)nhp;
+                       nhp->rtnh_len = skb_tail_pointer(skb) - (unsigned char *)nhp;
                } endfor_nexthops(fi);
                mp_head->rta_type = RTA_MULTIPATH;
-               mp_head->rta_len = skb->tail - (u8*)mp_head;
+               mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head;
        }
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 
index 0e62def05a58b38f589b5594db24f140bdc07132..ceefd9dd0c92c90535c2fc6ee796629eb67bd342 100644 (file)
@@ -33,7 +33,7 @@ static struct sk_buff *dnrmg_build_message(struct sk_buff *rt_skb, int *errp)
 {
        struct sk_buff *skb = NULL;
        size_t size;
-       unsigned char *old_tail;
+       sk_buff_data_t old_tail;
        struct nlmsghdr *nlh;
        unsigned char *ptr;
        struct nf_dn_rtmsg *rtm;
index 78993dadb53a9f5802302839bb8c2d1d84deb20b..b5524f32ac2d5128aa0f3513c3fb45e3f52fe215 100644 (file)
@@ -366,7 +366,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
                        fh->cb = cb;
                        fh->port = port;
                        if (sock->type != SOCK_DGRAM) {
-                               skb->tail = skb->data;
+                               skb_reset_tail_pointer(skb);
                                skb->len = 0;
                        } else if (res < 0)
                                goto out_free;
index 59a765c49cf9e5ab74ce1316b0b7063f660b1aa4..2b854941e06c5d1d5b079034f1d6975352efb017 100644 (file)
@@ -595,7 +595,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
                if (frag != 0)
                        flen -= hdrlen;
 
-               if (frag_skb->tail + flen > frag_skb->end) {
+               if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) {
                        printk(KERN_WARNING "%s: host decrypted and "
                               "reassembled frame did not fit skb\n",
                               dev->name);
index de019f9fbfe13bb819a5002766d2d161931fc7e2..5e5613930ffbe1f8fa5bd136179f167566236fc7 100644 (file)
@@ -21,6 +21,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
        struct blkcipher_desc desc;
        struct esp_data *esp;
        struct sk_buff *trailer;
+       u8 *tail;
        int blksize;
        int clen;
        int alen;
@@ -49,12 +50,13 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
                goto error;
 
        /* Fill padding... */
+       tail = skb_tail_pointer(trailer);
        do {
                int i;
                for (i=0; i<clen-skb->len - 2; i++)
-                       *(u8*)(trailer->tail + i) = i+1;
+                       tail[i] = i + 1;
        } while (0);
-       *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
+       tail[clen - skb->len - 2] = (clen - skb->len) - 2;
        pskb_put(skb, trailer, clen - skb->len);
 
        __skb_push(skb, skb->data - skb_network_header(skb));
@@ -62,7 +64,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
        esph = (struct ip_esp_hdr *)(skb_network_header(skb) +
                                     top_iph->ihl * 4);
        top_iph->tot_len = htons(skb->len + alen);
-       *(u8*)(trailer->tail - 1) = top_iph->protocol;
+       *(skb_tail_pointer(skb) - 1) = top_iph->protocol;
 
        /* this is non-NULL only with UDP Encapsulation */
        if (x->encap) {
index 8372f8b8f0cd010596cd017f4191f71b19a594cb..d38cbba92a4dddf62a7d53da29671ce0fa1896d7 100644 (file)
@@ -450,7 +450,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
         */
        iph = ip_hdr(skb_in);
 
-       if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail)
+       if ((u8 *)iph < skb_in->head ||
+           (skb_in->network_header + sizeof(*iph)) > skb_in->tail)
                goto out;
 
        /*
index 1fc637fb675095333adf5265cda9cef8707911f2..2506021c29351ca59fa48395596986b2e153f4da 100644 (file)
@@ -348,8 +348,8 @@ static int igmpv3_sendpack(struct sk_buff *skb)
 {
        struct iphdr *pip = ip_hdr(skb);
        struct igmphdr *pig = igmp_hdr(skb);
-       const int iplen = skb->tail - skb_network_header(skb);
-       const int igmplen = skb->tail - skb_transport_header(skb);
+       const int iplen = skb->tail - skb->network_header;
+       const int igmplen = skb->tail - skb->transport_header;
 
        pip->tot_len = htons(iplen);
        ip_send_check(pip);
index 5df71cd08da811e65b354abb82ed9103664d0e73..37362cd1d07fd135e5d3468220fa1ca66fa6a49b 100644 (file)
@@ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk,
        struct nlmsghdr  *nlh;
        void *info = NULL;
        struct inet_diag_meminfo  *minfo = NULL;
-       unsigned char    *b = skb->tail;
+       unsigned char    *b = skb_tail_pointer(skb);
        const struct inet_diag_handler *handler;
 
        handler = inet_diag_table[unlh->nlmsg_type];
@@ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk,
            icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info)
                icsk->icsk_ca_ops->get_info(sk, ext, skb);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
@@ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
 {
        long tmo;
        struct inet_diag_msg *r;
-       const unsigned char *previous_tail = skb->tail;
+       const unsigned char *previous_tail = skb_tail_pointer(skb);
        struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq,
                                         unlh->nlmsg_type, sizeof(*r));
 
@@ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
                               &tw6->tw_v6_daddr);
        }
 #endif
-       nlh->nlmsg_len = skb->tail - previous_tail;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail;
        return skb->len;
 nlmsg_failure:
        skb_trim(skb, previous_tail - skb->data);
@@ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
 {
        const struct inet_request_sock *ireq = inet_rsk(req);
        struct inet_sock *inet = inet_sk(sk);
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct inet_diag_msg *r;
        struct nlmsghdr *nlh;
        long tmo;
@@ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
                               &inet6_rsk(req)->rmt_addr);
        }
 #endif
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 
        return skb->len;
 
index fcb35cd5ccfd0d9346227c32a3afe22b87422d3b..c199d2311731e0ffbb3202a7306ecbeeaaa7d1db 100644 (file)
@@ -316,7 +316,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
        serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
        serr->port = port;
 
-       __skb_pull(skb, skb->tail - skb->data);
+       __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
        skb_reset_transport_header(skb);
 
        if (sock_queue_err_skb(sk, skb))
index 50d0b301380e7d1c94fd9ff1e68c133cbec77b7d..ea0a491dce92a91737f42386a07fc8a3acebe70d 100644 (file)
@@ -513,7 +513,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
                        struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
 
                        if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) {
-                               nlh->nlmsg_len = skb->tail - (u8*)nlh;
+                               nlh->nlmsg_len = (skb_tail_pointer(skb) -
+                                                 (u8 *)nlh);
                        } else {
                                nlh->nlmsg_type = NLMSG_ERROR;
                                nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr));
@@ -580,7 +581,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
         *      Copy the IP header
         */
 
-       skb_set_network_header(skb, skb->tail - skb->data);
+       skb->network_header = skb->tail;
        skb_put(skb, ihl);
        memcpy(skb->data,pkt->data,ihl);
        ip_hdr(skb)->protocol = 0;                      /* Flag to the kernel this is a route add */
@@ -1544,7 +1545,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
        int ct;
        struct rtnexthop *nhp;
        struct net_device *dev = vif_table[c->mfc_parent].dev;
-       u8 *b = skb->tail;
+       u8 *b = skb_tail_pointer(skb);
        struct rtattr *mp_head;
 
        if (dev)
@@ -1564,7 +1565,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
                }
        }
        mp_head->rta_type = RTA_MULTIPATH;
-       mp_head->rta_len = skb->tail - (u8*)mp_head;
+       mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head;
        rtm->rtm_type = RTN_MULTICAST;
        return 1;
 
index 25bd68967305e3492a5bf6e30ccab4a7da25df7e..344ddbbdc756a05cefe7a9227e2272ed6b7bb44d 100644 (file)
@@ -162,7 +162,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
                iph = ip_hdr(*pskb);
                th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]);
                data = (char *)th + (th->doff << 2);
-               data_limit = (*pskb)->tail;
+               data_limit = skb_tail_pointer(*pskb);
 
                if (ip_vs_ftp_get_addrport(data, data_limit,
                                           SERVER_STRING,
@@ -269,7 +269,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
           the length of the header in 32-bit multiples, it is accurate
           to calculate data address by th+HLEN*4 */
        data = data_start = (char *)th + (th->doff << 2);
-       data_limit = (*pskb)->tail;
+       data_limit = skb_tail_pointer(*pskb);
 
        while (data <= data_limit - 6) {
                if (strnicmp(data, "PASV\r\n", 6) == 0) {
index b4450f1ccc1bdd15db00f6ed0201bb5a50aba4b5..6298d404e7c7950099d25c7ad1e71d0ababfa91e 100644 (file)
@@ -37,28 +37,28 @@ target(struct sk_buff **pskb,
        /* We assume that pln and hln were checked in the match */
        if (mangle->flags & ARPT_MANGLE_SDEV) {
                if (ARPT_DEV_ADDR_LEN_MAX < hln ||
-                  (arpptr + hln > (**pskb).tail))
+                  (arpptr + hln > skb_tail_pointer(*pskb)))
                        return NF_DROP;
                memcpy(arpptr, mangle->src_devaddr, hln);
        }
        arpptr += hln;
        if (mangle->flags & ARPT_MANGLE_SIP) {
                if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
-                  (arpptr + pln > (**pskb).tail))
+                  (arpptr + pln > skb_tail_pointer(*pskb)))
                        return NF_DROP;
                memcpy(arpptr, &mangle->u_s.src_ip, pln);
        }
        arpptr += pln;
        if (mangle->flags & ARPT_MANGLE_TDEV) {
                if (ARPT_DEV_ADDR_LEN_MAX < hln ||
-                  (arpptr + hln > (**pskb).tail))
+                  (arpptr + hln > skb_tail_pointer(*pskb)))
                        return NF_DROP;
                memcpy(arpptr, mangle->tgt_devaddr, hln);
        }
        arpptr += hln;
        if (mangle->flags & ARPT_MANGLE_TIP) {
                if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
-                  (arpptr + pln > (**pskb).tail))
+                  (arpptr + pln > skb_tail_pointer(*pskb)))
                        return NF_DROP;
                memcpy(arpptr, &mangle->u_t.tgt_ip, pln);
        }
index 5842f1aa973ae8079e72e9c534932ad8dafda1a8..15e0d200223511de282822385ceb4bac3ddfc50a 100644 (file)
@@ -191,7 +191,7 @@ ipq_flush(int verdict)
 static struct sk_buff *
 ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
 {
-       unsigned char *old_tail;
+       sk_buff_data_t old_tail;
        size_t size = 0;
        size_t data_len = 0;
        struct sk_buff *skb;
@@ -235,7 +235,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
        if (!skb)
                goto nlmsg_failure;
 
-       old_tail= skb->tail;
+       old_tail = skb->tail;
        nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
        pmsg = NLMSG_DATA(nlh);
        memset(pmsg, 0, sizeof(*pmsg));
index c2c92ff1278189371307cef1db000243b08a171d..8a40fbe842b7cb197d0ddc5ab852e0f6b9176f5b 100644 (file)
@@ -92,7 +92,8 @@ static void mangle_contents(struct sk_buff *skb,
        /* move post-replacement */
        memmove(data + match_offset + rep_len,
                data + match_offset + match_len,
-               skb->tail - (data + match_offset + match_len));
+               skb->tail - (skb->network_header + dataoff +
+                            match_offset + match_len));
 
        /* insert data from buffer */
        memcpy(data + match_offset, rep_buffer, rep_len);
index 2b214cc3724cc0a958189140d00f2a479dba371e..18a09a78ca0bfdcca2cc49f1d1b03616f30deac4 100644 (file)
@@ -2231,7 +2231,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
                th->cwr = 0;
        } while (skb->next);
 
-       delta = htonl(oldlen + (skb->tail - skb_transport_header(skb)) +
+       delta = htonl(oldlen + (skb->tail - skb->transport_header) +
                      skb->data_len);
        th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
                                (__force u32)delta));
index 29c53fbb2204af68fa693a8a03f9655ec65cc7cd..c22cdcd8432062ba15d1b6e3d97c8e3b5dc99940 100644 (file)
@@ -733,7 +733,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
        }
        skb_shinfo(skb)->nr_frags = k;
 
-       skb->tail = skb->data;
+       skb_reset_tail_pointer(skb);
        skb->data_len -= len;
        skb->len = skb->data_len;
 }
index f16f4f0c5814fd8cc35540349043342d6bee70af..4a355fea40985c1b1dcd511076de4e9ff6e21462 100644 (file)
@@ -268,7 +268,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
        serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
        serr->port = fl->fl_ip_dport;
 
-       __skb_pull(skb, skb->tail - skb->data);
+       __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
        skb_reset_transport_header(skb);
 
        if (sock_queue_err_skb(sk, skb))
index 7fdf84dee73f3ab080e66333c7a3b48d8c852ec0..b8e8914cc0021343d4564921067dcaf22fbed3c4 100644 (file)
@@ -51,6 +51,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
        int clen;
        int alen;
        int nfrags;
+       u8 *tail;
        struct esp_data *esp = x->data;
        int hdr_len = (skb_transport_offset(skb) +
                       sizeof(*esph) + esp->conf.ivlen);
@@ -78,18 +79,19 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
        }
 
        /* Fill padding... */
+       tail = skb_tail_pointer(trailer);
        do {
                int i;
                for (i=0; i<clen-skb->len - 2; i++)
-                       *(u8*)(trailer->tail + i) = i+1;
+                       tail[i] = i + 1;
        } while (0);
-       *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
+       tail[clen-skb->len - 2] = (clen - skb->len) - 2;
        pskb_put(skb, trailer, clen - skb->len);
 
        top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len);
        esph = (struct ipv6_esp_hdr *)skb_transport_header(skb);
        top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph));
-       *(u8 *)(trailer->tail - 1) = *skb_network_header(skb);
+       *(skb_tail_pointer(skb) - 1) = *skb_network_header(skb);
        *skb_network_header(skb) = IPPROTO_ESP;
 
        esph->spi = x->id.spi;
index a6a275db88cdd8aa315f2e5a7b14911342ee7345..275d2e812a44e882780c249a09fe3205e3159fac 100644 (file)
@@ -51,7 +51,7 @@
 int ipv6_find_tlv(struct sk_buff *skb, int offset, int type)
 {
        const unsigned char *nh = skb_network_header(skb);
-       int packet_len = skb->tail - nh;
+       int packet_len = skb->tail - skb->network_header;
        struct ipv6_opt_hdr *hdr;
        int len;
 
index d3edc3cf1ce93bf44870681f202a2b9263ed1ff9..e94992ab92e6b68520b8a78fcd35167b04ecc241 100644 (file)
@@ -317,7 +317,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
        int hlimit, tclass;
        int err = 0;
 
-       if ((u8*)hdr < skb->head || (u8*)(hdr+1) > skb->tail)
+       if ((u8 *)hdr < skb->head ||
+           (skb->network_header + sizeof(*hdr)) > skb->tail)
                return;
 
        /*
index b2c092c6b9dcf59e508384f5c2bdc18614f5f622..e2b8db6b9aef0f0319031ba1ff86052518cf66dc 100644 (file)
@@ -514,7 +514,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
        u16 offset = sizeof(struct ipv6hdr);
        struct ipv6_opt_hdr *exthdr =
                                (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
-       unsigned int packet_len = skb->tail - skb_network_header(skb);
+       unsigned int packet_len = skb->tail - skb->network_header;
        int found_rhdr = 0;
        *nexthdr = &ipv6_hdr(skb)->nexthdr;
 
index 4c45bcce75e895bfc764b5148abea46b207dc818..6c2758951d601cb5b4246958b66b62ff9a78787d 100644 (file)
@@ -1423,7 +1423,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
 
        memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
 
-       skb_set_transport_header(skb, skb->tail - skb->data);
+       skb_set_transport_header(skb, skb_tail_pointer(skb) - skb->data);
        skb_put(skb, sizeof(*pmr));
        pmr = (struct mld2_report *)skb_transport_header(skb);
        pmr->type = ICMPV6_MLD2_REPORT;
@@ -1468,8 +1468,8 @@ static void mld_sendpack(struct sk_buff *skb)
        int err;
 
        IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
-       payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6);
-       mldlen = skb->tail - skb_transport_header(skb);
+       payload_len = (skb->tail - skb->network_header) - sizeof(*pip6);
+       mldlen = skb->tail - skb->transport_header;
        pip6->payload_len = htons(payload_len);
 
        pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen,
index f0288e92fb52ef0ac496648d73f74214c57590ca..6ed763ee6785ac7bd5db2f3d3b8587a58b19feff 100644 (file)
@@ -260,7 +260,7 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb,
        struct ipv6_opt_hdr *exthdr =
                                   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
        const unsigned char *nh = skb_network_header(skb);
-       unsigned int packet_len = skb->tail - nh;
+       unsigned int packet_len = skb->tail - skb->network_header;
        int found_rhdr = 0;
 
        *nexthdr = &ipv6_hdr(skb)->nexthdr;
@@ -392,7 +392,7 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb,
        struct ipv6_opt_hdr *exthdr =
                                   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
        const unsigned char *nh = skb_network_header(skb);
-       unsigned int packet_len = skb->tail - nh;
+       unsigned int packet_len = skb->tail - skb->network_header;
        int found_rhdr = 0;
 
        *nexthdr = &ipv6_hdr(skb)->nexthdr;
index f8e619772fb4795021a1cc5d8c4eba4bce3234cc..b1cf7081647775c1f819728bb177a89a17502fa6 100644 (file)
@@ -492,7 +492,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
        skb_reserve(skb, LL_RESERVED_SPACE(dev));
        ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len);
 
-       skb_set_transport_header(skb, skb->tail - skb->data);
+       skb->transport_header = skb->tail;
        skb_put(skb, len);
        msg = (struct nd_msg *)skb_transport_header(skb);
 
@@ -584,7 +584,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
        skb_reserve(skb, LL_RESERVED_SPACE(dev));
        ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
 
-       skb_set_transport_header(skb, skb->tail - skb->data);
+       skb->transport_header = skb->tail;
        skb_put(skb, len);
        msg = (struct nd_msg *)skb_transport_header(skb);
        msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION;
@@ -685,7 +685,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
        skb_reserve(skb, LL_RESERVED_SPACE(dev));
        ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
 
-       skb_set_transport_header(skb, skb->tail - skb->data);
+       skb->transport_header = skb->tail;
        skb_put(skb, len);
        hdr = icmp6_hdr(skb);
        hdr->icmp6_type = NDISC_ROUTER_SOLICITATION;
@@ -767,7 +767,8 @@ static void ndisc_recv_ns(struct sk_buff *skb)
        struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
        struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
        u8 *lladdr = NULL;
-       u32 ndoptlen = skb->tail - msg->opt;
+       u32 ndoptlen = skb->tail - (skb->transport_header +
+                                   offsetof(struct nd_msg, opt));
        struct ndisc_options ndopts;
        struct net_device *dev = skb->dev;
        struct inet6_ifaddr *ifp;
@@ -945,7 +946,8 @@ static void ndisc_recv_na(struct sk_buff *skb)
        struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
        struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
        u8 *lladdr = NULL;
-       u32 ndoptlen = skb->tail - msg->opt;
+       u32 ndoptlen = skb->tail - (skb->transport_header +
+                                   offsetof(struct nd_msg, opt));
        struct ndisc_options ndopts;
        struct net_device *dev = skb->dev;
        struct inet6_ifaddr *ifp;
@@ -1111,8 +1113,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
        __u8 * opt = (__u8 *)(ra_msg + 1);
 
-       optlen = (skb->tail - skb_transport_header(skb)) -
-                 sizeof(struct ra_msg);
+       optlen = (skb->tail - skb->transport_header) - sizeof(struct ra_msg);
 
        if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
@@ -1361,7 +1362,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
                return;
        }
 
-       optlen = skb->tail - skb_transport_header(skb);
+       optlen = skb->tail - skb->transport_header;
        optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr);
 
        if (optlen < 0) {
@@ -1522,7 +1523,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
                   IPPROTO_ICMPV6, len);
 
-       skb_set_transport_header(buff, buff->tail - buff->data);
+       skb_set_transport_header(buff, skb_tail_pointer(buff) - buff->data);
        skb_put(buff, len);
        icmph = icmp6_hdr(buff);
 
index 66a2c41352515fb64eaadf8e7761e20030fac08e..5cfce218c5e199d14371ee9a4d4ee80a57efb7ef 100644 (file)
@@ -189,7 +189,7 @@ ipq_flush(int verdict)
 static struct sk_buff *
 ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
 {
-       unsigned char *old_tail;
+       sk_buff_data_t old_tail;
        size_t size = 0;
        size_t data_len = 0;
        struct sk_buff *skb;
@@ -233,7 +233,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
        if (!skb)
                goto nlmsg_failure;
 
-       old_tail= skb->tail;
+       old_tail = skb->tail;
        nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
        pmsg = NLMSG_DATA(nlh);
        memset(pmsg, 0, sizeof(*pmsg));
index 8705f6a502d9e8ddb37500cad390d2b31dc3510a..2b3be68b70a7ee6d8f2ae912de4dbd1600f5ab89 100644 (file)
@@ -1077,7 +1077,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
                        spin_lock_bh(&sk->sk_receive_queue.lock);
                        skb = skb_peek(&sk->sk_receive_queue);
                        if (skb != NULL)
-                               amount = skb->tail - skb_transport_header(skb);
+                               amount = skb->tail - skb->transport_header;
                        spin_unlock_bh(&sk->sk_receive_queue.lock);
                        return put_user(amount, (int __user *)arg);
                }
index 01d7c9c7b3b4ea7875e4c3d8a30ca7a5dfa7e2e9..e5e4792a0314d8e1d21652abf61d29d977c336fb 100644 (file)
@@ -133,8 +133,8 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
         * Inserting is a little bit tricky since we don't know how much
         * room we will need. But this should hopefully work OK
         */
-       count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb),
-                                 &ircomm_param_info);
+       count = irda_param_insert(self, pi, skb_tail_pointer(skb),
+                                 skb_tailroom(skb), &ircomm_param_info);
        if (count < 0) {
                IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__);
                spin_unlock_irqrestore(&self->spinlock, flags);
index fcf9d6599628cdba2d2e52b937d1f1e0f96ead0e..ed69773b0f8ed8d2d1dd3183fbb97d6c1984f75e 100644 (file)
@@ -1039,7 +1039,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
        }
 
        /* Insert at end of sk-buffer */
-       frame = skb->tail;
+       frame = skb_tail_pointer(skb);
 
        /* Make space for data */
        if (skb_tailroom(skb) < (param_len+value_len+3)) {
index 349012c926b704aa6ce28a645090ccd1413f3d0f..aeb18cf1dcae7e88cbb7636fce13b360d6f1fc30 100644 (file)
@@ -469,49 +469,49 @@ int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
        int ret;
 
        /* Insert data rate */
-       ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail,
+       ret = irda_param_insert(self, PI_BAUD_RATE, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert max turnaround time */
-       ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail,
+       ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert data size */
-       ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail,
+       ret = irda_param_insert(self, PI_DATA_SIZE, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert window size */
-       ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail,
+       ret = irda_param_insert(self, PI_WINDOW_SIZE, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert additional BOFs */
-       ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail,
+       ret = irda_param_insert(self, PI_ADD_BOFS, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert minimum turnaround time */
-       ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail,
+       ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
        skb_put(skb, ret);
 
        /* Insert link disconnect/threshold time */
-       ret = irda_param_insert(self, PI_LINK_DISC, skb->tail,
+       ret = irda_param_insert(self, PI_LINK_DISC, skb_tail_pointer(skb),
                                skb_tailroom(skb), &irlap_param_info);
        if (ret < 0)
                return ret;
index 48f05314ebf7421f6141d822a908f10f1f47803e..442300c633d710214b427ef810df89ec0ed8f93c 100644 (file)
@@ -268,9 +268,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        struct nlmsghdr *nlh;
        struct nfgenmsg *nfmsg;
        struct nfattr *nest_parms;
-       unsigned char *b;
-
-       b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        event |= NFNL_SUBSYS_CTNETLINK << 8;
        nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg));
@@ -303,7 +301,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
            ctnetlink_dump_use(skb, ct) < 0)
                goto nfattr_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -322,7 +320,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
        struct nf_conn *ct = (struct nf_conn *)ptr;
        struct sk_buff *skb;
        unsigned int type;
-       unsigned char *b;
+       sk_buff_data_t b;
        unsigned int flags = 0, group;
 
        /* ignore our fake conntrack entry */
@@ -1152,9 +1150,7 @@ ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
 {
        struct nlmsghdr *nlh;
        struct nfgenmsg *nfmsg;
-       unsigned char *b;
-
-       b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        event |= NFNL_SUBSYS_CTNETLINK_EXP << 8;
        nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg));
@@ -1168,7 +1164,7 @@ ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        if (ctnetlink_exp_dump_expect(skb, exp) < 0)
                goto nfattr_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -1186,7 +1182,7 @@ static int ctnetlink_expect_event(struct notifier_block *this,
        struct nf_conntrack_expect *exp = (struct nf_conntrack_expect *)ptr;
        struct sk_buff *skb;
        unsigned int type;
-       unsigned char *b;
+       sk_buff_data_t b;
        int flags = 0;
 
        if (events & IPEXP_NEW) {
index 5eeebd2efa7a734848ef5630e7fa5caad1ce09eb..9709f94787f824d029f4c1123a7de787cc4b16b4 100644 (file)
@@ -409,15 +409,14 @@ __build_packet_message(struct nfulnl_instance *inst,
                        const struct nf_loginfo *li,
                        const char *prefix, unsigned int plen)
 {
-       unsigned char *old_tail;
        struct nfulnl_msg_packet_hdr pmsg;
        struct nlmsghdr *nlh;
        struct nfgenmsg *nfmsg;
        __be32 tmp_uint;
+       sk_buff_data_t old_tail = inst->skb->tail;
 
        UDEBUG("entered\n");
 
-       old_tail = inst->skb->tail;
        nlh = NLMSG_PUT(inst->skb, 0, 0,
                        NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET,
                        sizeof(struct nfgenmsg));
index cfbee39f61d6a10ba2bfe27a2008c2283de9acf0..b6585caa431e12c65e3bab7c611fc7cbab9bc708 100644 (file)
@@ -338,7 +338,7 @@ static struct sk_buff *
 nfqnl_build_packet_message(struct nfqnl_instance *queue,
                           struct nfqnl_queue_entry *entry, int *errp)
 {
-       unsigned char *old_tail;
+       sk_buff_data_t old_tail;
        size_t size;
        size_t data_len = 0;
        struct sk_buff *skb;
@@ -404,7 +404,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
        if (!skb)
                goto nlmsg_failure;
 
-       old_tail= skb->tail;
+       old_tail = skb->tail;
        nlh = NLMSG_PUT(skb, 0, 0,
                        NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET,
                        sizeof(struct nfgenmsg));
index 50dc5edb7752308f896c87976f5b64052cc9c451..fdb6eb13cbcbd43ae5487787ef0e57dbb06ccad0 100644 (file)
@@ -785,7 +785,7 @@ static inline struct sk_buff *netlink_trim(struct sk_buff *skb,
 
        skb_orphan(skb);
 
-       delta = skb->end - skb->tail;
+       delta = skb->end - skb_tail_pointer(skb);
        if (delta * 2 < skb->truesize)
                return skb;
 
index 51c059b09a37754718144b652ed28923702cefcb..36388b2f32f94db502f70813981766470c1781ef 100644 (file)
@@ -775,7 +775,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
                err = -EINVAL;
                res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len);
                if (sock->type != SOCK_DGRAM) {
-                       skb->tail = skb->data;
+                       skb_reset_tail_pointer(skb);
                        skb->len = 0;
                } else if (res < 0)
                        goto out_free;
index cb21617a5670516a9719623a5cceecd62bdca961..28326fb1fc4e3b9a6e7ec8b494604440dea0adce 100644 (file)
@@ -93,7 +93,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
                                continue;
                        a->priv = p;
                        a->order = n_i;
-                       r = (struct rtattr*) skb->tail;
+                       r = (struct rtattr *)skb_tail_pointer(skb);
                        RTA_PUT(skb, a->order, 0, NULL);
                        err = tcf_action_dump_1(skb, a, 0, 0);
                        if (err < 0) {
@@ -101,7 +101,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
                                skb_trim(skb, (u8*)r - skb->data);
                                goto done;
                        }
-                       r->rta_len = skb->tail - (u8*)r;
+                       r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
                        n_i++;
                        if (n_i >= TCA_ACT_MAX_PRIO)
                                goto done;
@@ -125,7 +125,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
        struct rtattr *r ;
        int i= 0, n_i = 0;
 
-       r = (struct rtattr*) skb->tail;
+       r = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, a->order, 0, NULL);
        RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
        for (i = 0; i < (hinfo->hmask + 1); i++) {
@@ -140,7 +140,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
                }
        }
        RTA_PUT(skb, TCA_FCNT, 4, &n_i);
-       r->rta_len = skb->tail - (u8*)r;
+       r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
 
        return n_i;
 rtattr_failure:
@@ -423,7 +423,7 @@ int
 tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
        int err = -EINVAL;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *r;
 
        if (a->ops == NULL || a->ops->dump == NULL)
@@ -432,10 +432,10 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
        RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
        if (tcf_action_copy_stats(skb, a, 0))
                goto rtattr_failure;
-       r = (struct rtattr*) skb->tail;
+       r = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) {
-               r->rta_len = skb->tail - (u8*)r;
+               r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
                return err;
        }
 
@@ -449,17 +449,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
 {
        struct tc_action *a;
        int err = -EINVAL;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *r ;
 
        while ((a = act) != NULL) {
-               r = (struct rtattr*) skb->tail;
+               r = (struct rtattr *)skb_tail_pointer(skb);
                act = a->next;
                RTA_PUT(skb, a->order, 0, NULL);
                err = tcf_action_dump_1(skb, a, bind, ref);
                if (err < 0)
                        goto errout;
-               r->rta_len = skb->tail - (u8*)r;
+               r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
        }
 
        return 0;
@@ -635,7 +635,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
 {
        struct tcamsg *t;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *x;
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
@@ -645,15 +645,15 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
-       x = (struct rtattr*) skb->tail;
+       x = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
 
        if (tcf_action_dump(skb, a, bind, ref) < 0)
                goto rtattr_failure;
 
-       x->rta_len = skb->tail - (u8*)x;
+       x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
@@ -767,7 +767,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
                return -ENOBUFS;
        }
 
-       b = (unsigned char *)skb->tail;
+       b = skb_tail_pointer(skb);
 
        if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
                goto err_out;
@@ -783,16 +783,16 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
-       x = (struct rtattr *) skb->tail;
+       x = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
 
        err = a->ops->walk(skb, &dcb, RTM_DELACTION, a);
        if (err < 0)
                goto rtattr_failure;
 
-       x->rta_len = skb->tail - (u8 *) x;
+       x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        nlh->nlmsg_flags |= NLM_F_ROOT;
        module_put(a->ops->owner);
        kfree(a);
@@ -884,7 +884,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
        if (!skb)
                return -ENOBUFS;
 
-       b = (unsigned char *)skb->tail;
+       b = skb_tail_pointer(skb);
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
        t = NLMSG_DATA(nlh);
@@ -892,15 +892,15 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
-       x = (struct rtattr*) skb->tail;
+       x = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
 
        if (tcf_action_dump(skb, a, 0, 0) < 0)
                goto rtattr_failure;
 
-       x->rta_len = skb->tail - (u8*)x;
+       x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        NETLINK_CB(skb).dst_group = RTNLGRP_TC;
 
        err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
@@ -1015,7 +1015,7 @@ static int
 tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
 {
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *x;
        struct tc_action_ops *a_o;
        struct tc_action a;
@@ -1048,7 +1048,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
-       x = (struct rtattr *) skb->tail;
+       x = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
 
        ret = a_o->walk(skb, cb, RTM_GETACTION, &a);
@@ -1056,12 +1056,12 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
                goto rtattr_failure;
 
        if (ret > 0) {
-               x->rta_len = skb->tail - (u8 *) x;
+               x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
                ret = skb->len;
        } else
                skb_trim(skb, (u8*)x - skb->data);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        if (NETLINK_CB(cb->skb).pid && ret)
                nlh->nlmsg_flags |= NLM_F_MULTI;
        module_put(a_o->owner);
index 87d0faf328672ef5d951bdd4b073a963ecc45389..aad748b3b38c7c0da639c8cdbacabb7a26ad86b1 100644 (file)
@@ -155,7 +155,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result
 
 static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_gact opt;
        struct tcf_gact *gact = a->priv;
        struct tcf_t t;
index 47f0b13242395d7b2e71447bdc1e9daaef2bba52..2ccfd5b20fab9708b4569f028b8bc737fa2bf274 100644 (file)
@@ -245,7 +245,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a,
 
 static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_ipt *ipt = a->priv;
        struct ipt_entry_target *t;
        struct tcf_t tm;
index 3e93683e9ab3c666f15f0651d5c603a0833fb4ae..15f6ecdaf611abb703e16b7908de57adfc69b00f 100644 (file)
@@ -206,7 +206,7 @@ bad_mirred:
 
 static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_mirred *m = a->priv;
        struct tc_mirred opt;
        struct tcf_t t;
index 20813eee8af48c38a7da54ddd9a18c116662c346..d654cea1a46ce17ca4b109e07f6e471076619482 100644 (file)
@@ -195,7 +195,7 @@ done:
 static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
                          int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_pedit *p = a->priv;
        struct tc_pedit *opt;
        struct tcf_t t;
index 10a5a5c36f76cdd70ac7297dff3dcf215fceda6b..068b23763665f4aa6e31b5b4320c6a4d0c157b03 100644 (file)
@@ -80,7 +80,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
                                continue;
                        a->priv = p;
                        a->order = index;
-                       r = (struct rtattr*) skb->tail;
+                       r = (struct rtattr *)skb_tail_pointer(skb);
                        RTA_PUT(skb, a->order, 0, NULL);
                        if (type == RTM_DELACTION)
                                err = tcf_action_dump_1(skb, a, 0, 1);
@@ -91,7 +91,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
                                skb_trim(skb, (u8*)r - skb->data);
                                goto done;
                        }
-                       r->rta_len = skb->tail - (u8*)r;
+                       r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
                        n_i++;
                }
        }
@@ -326,7 +326,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
 static int
 tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_police *police = a->priv;
        struct tc_police opt;
 
@@ -572,7 +572,7 @@ EXPORT_SYMBOL(tcf_police);
 
 int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_police opt;
 
        opt.index = police->tcf_index;
index c7971182af0752d67b267a22e607f58dc0dd1613..ecbcfa59b76cc61b44e7bb71867ee798aa47550b 100644 (file)
@@ -155,7 +155,7 @@ static inline int tcf_simp_cleanup(struct tc_action *a, int bind)
 static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
                                int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_defact *d = a->priv;
        struct tc_defact opt;
        struct tcf_t t;
index 5c6ffdb77d2d69bfdc35869b388a3e486ca18603..84231baf77d1fb64afbabd221549fe1f59a55564 100644 (file)
@@ -323,7 +323,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
 {
        struct tcmsg *tcm;
        struct nlmsghdr  *nlh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
        tcm = NLMSG_DATA(nlh);
@@ -340,7 +340,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
                if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0)
                        goto rtattr_failure;
        }
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -563,30 +563,30 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
                 * to work with both old and new modes of entering
                 * tc data even if iproute2  was newer - jhs
                 */
-               struct rtattr * p_rta = (struct rtattr*) skb->tail;
+               struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
 
                if (exts->action->type != TCA_OLD_COMPAT) {
                        RTA_PUT(skb, map->action, 0, NULL);
                        if (tcf_action_dump(skb, exts->action, 0, 0) < 0)
                                goto rtattr_failure;
-                       p_rta->rta_len = skb->tail - (u8*)p_rta;
+                       p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
                } else if (map->police) {
                        RTA_PUT(skb, map->police, 0, NULL);
                        if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0)
                                goto rtattr_failure;
-                       p_rta->rta_len = skb->tail - (u8*)p_rta;
+                       p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
                }
        }
 #elif defined CONFIG_NET_CLS_POLICE
        if (map->police && exts->police) {
-               struct rtattr * p_rta = (struct rtattr*) skb->tail;
+               struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
 
                RTA_PUT(skb, map->police, 0, NULL);
 
                if (tcf_police_dump(skb, exts->police) < 0)
                        goto rtattr_failure;
 
-               p_rta->rta_len = skb->tail - (u8*)p_rta;
+               p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
        }
 #endif
        return 0;
index 4a91f082a81d11911b2bfd6f43132897916c8f3e..800ec2ac326b5ae91be25d5ee051b391ec63c9a2 100644 (file)
@@ -245,7 +245,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
                      struct sk_buff *skb, struct tcmsg *t)
 {
        struct basic_filter *f = (struct basic_filter *) fh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        if (f == NULL)
@@ -263,7 +263,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
            tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
                goto rtattr_failure;
 
-       rta->rta_len = (skb->tail - b);
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
index 5dbb9d451f7300a0620019656f695dbe0506ab78..f5f355852a87012901555b9f23ac499d742cb3fc 100644 (file)
@@ -348,7 +348,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
 {
        struct fw_head *head = (struct fw_head *)tp->root;
        struct fw_filter *f = (struct fw_filter*)fh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        if (f == NULL)
@@ -374,7 +374,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
        if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0)
                goto rtattr_failure;
 
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
 
        if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0)
                goto rtattr_failure;
index abc47cc48ad00b8d9a404fa4219b97aef7162dae..1f94df36239d365fcd173069473b4dfa70573ba1 100644 (file)
@@ -562,7 +562,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
                       struct sk_buff *skb, struct tcmsg *t)
 {
        struct route4_filter *f = (struct route4_filter*)fh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
        u32 id;
 
@@ -591,7 +591,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
        if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
                goto rtattr_failure;
 
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
 
        if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0)
                goto rtattr_failure;
index 6f373b020eb4cc893704ecc01f8f65f3f8b3a24c..87ed6f3c5070f20a449d3c36563d3c09683d252f 100644 (file)
@@ -593,7 +593,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
 {
        struct rsvp_filter *f = (struct rsvp_filter*)fh;
        struct rsvp_session *s;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
        struct tc_rsvp_pinfo pinfo;
 
@@ -623,7 +623,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
        if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
                goto rtattr_failure;
 
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
 
        if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0)
                goto rtattr_failure;
index 7563fdcef4b764e104636baef055bdf6542d356e..0537d6066b43c5c5c51c8537410b5b7c716e1594 100644 (file)
@@ -448,7 +448,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
 {
        struct tcindex_data *p = PRIV(tp);
        struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n",
@@ -463,7 +463,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
                RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift);
                RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through),
                    &p->fall_through);
-               rta->rta_len = skb->tail-b;
+               rta->rta_len = skb_tail_pointer(skb) - b;
        } else {
                if (p->perfect) {
                        t->tcm_handle = r-p->perfect;
@@ -486,7 +486,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
 
                if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
                        goto rtattr_failure;
-               rta->rta_len = skb->tail-b;
+               rta->rta_len = skb_tail_pointer(skb) - b;
 
                if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
                        goto rtattr_failure;
index 695b34051b9f5940742b8a8dc774807985423091..fa11bb750049b8af586714603b79d606f9d4d85d 100644 (file)
@@ -213,7 +213,7 @@ check_terminal:
                        off2 = 0;
                }
 
-               if (ptr < skb->tail)
+               if (ptr < skb_tail_pointer(skb))
                        goto next_ht;
        }
 
@@ -718,7 +718,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
                     struct sk_buff *skb, struct tcmsg *t)
 {
        struct tc_u_knode *n = (struct tc_u_knode*)fh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        if (n == NULL)
@@ -765,7 +765,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
 #endif
        }
 
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        if (TC_U32_KEY(n->handle))
                if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0)
                        goto rtattr_failure;
index 959c306c57143d9700a122d8332a3cd3ecca4a40..63146d339d814e09a19cd26ba6909e3c9c9e8b6b 100644 (file)
@@ -418,17 +418,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
 int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
 {
        int i;
-       struct rtattr * top_start = (struct rtattr*) skb->tail;
-       struct rtattr * list_start;
+       u8 *tail;
+       struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb);
+       struct rtattr *list_start;
 
        RTA_PUT(skb, tlv, 0, NULL);
        RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
 
-       list_start = (struct rtattr *) skb->tail;
+       list_start = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL);
 
+       tail = skb_tail_pointer(skb);
        for (i = 0; i < tree->hdr.nmatches; i++) {
-               struct rtattr *match_start = (struct rtattr*) skb->tail;
+               struct rtattr *match_start = (struct rtattr *)tail;
                struct tcf_ematch *em = tcf_em_get_match(tree, i);
                struct tcf_ematch_hdr em_hdr = {
                        .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER,
@@ -447,11 +449,12 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
                } else if (em->datalen > 0)
                        RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data);
 
-               match_start->rta_len = skb->tail - (u8*) match_start;
+               tail = skb_tail_pointer(skb);
+               match_start->rta_len = tail - (u8 *)match_start;
        }
 
-       list_start->rta_len = skb->tail - (u8 *) list_start;
-       top_start->rta_len = skb->tail - (u8 *) top_start;
+       list_start->rta_len = tail - (u8 *)list_start;
+       top_start->rta_len = tail - (u8 *)top_start;
 
        return 0;
 
index ecbdc6b42a9c16c4f4dbd32a2d5a445bf54741cd..7482a950717b70f363bc08a6f3ee12bfbf0a587d 100644 (file)
@@ -813,7 +813,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
 {
        struct tcmsg *tcm;
        struct nlmsghdr  *nlh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct gnet_dump d;
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
@@ -847,7 +847,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
        if (gnet_stats_finish_copy(&d) < 0)
                goto rtattr_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -1051,7 +1051,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
 {
        struct tcmsg *tcm;
        struct nlmsghdr  *nlh;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct gnet_dump d;
        struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;
 
@@ -1076,7 +1076,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
        if (gnet_stats_finish_copy(&d) < 0)
                goto rtattr_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
index baca8743c12ba78a70dc2f08b9acc8cfd33babea..1d7bb16321382449884ae7dde3132a537e90fb12 100644 (file)
@@ -631,7 +631,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
 {
        struct atm_qdisc_data *p = PRIV(sch);
        struct atm_flow_data *flow = (struct atm_flow_data *) cl;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n",
@@ -661,7 +661,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
 
                RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero);
        }
-       rta->rta_len = skb->tail-b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
index d83414d828d8e4b573b10d22ba1d0b6b846450a8..be98a01253e930bc905b3e9460602cfb2caaeee6 100644 (file)
@@ -1465,7 +1465,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
 
 static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate);
        return skb->len;
@@ -1477,7 +1477,7 @@ rtattr_failure:
 
 static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_cbq_lssopt opt;
 
        opt.flags = 0;
@@ -1502,7 +1502,7 @@ rtattr_failure:
 
 static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_cbq_wrropt opt;
 
        opt.flags = 0;
@@ -1520,7 +1520,7 @@ rtattr_failure:
 
 static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_cbq_ovl opt;
 
        opt.strategy = cl->ovl_strategy;
@@ -1537,7 +1537,7 @@ rtattr_failure:
 
 static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_cbq_fopt opt;
 
        if (cl->split || cl->defmap) {
@@ -1556,7 +1556,7 @@ rtattr_failure:
 #ifdef CONFIG_NET_CLS_POLICE
 static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl)
 {
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_cbq_police opt;
 
        if (cl->police) {
@@ -1590,14 +1590,14 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl)
 static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct cbq_sched_data *q = qdisc_priv(sch);
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        rta = (struct rtattr*)b;
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        if (cbq_dump_attr(skb, &q->link) < 0)
                goto rtattr_failure;
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
@@ -1619,7 +1619,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg,
               struct sk_buff *skb, struct tcmsg *tcm)
 {
        struct cbq_class *cl = (struct cbq_class*)arg;
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        if (cl->tparent)
@@ -1633,7 +1633,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg,
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        if (cbq_dump_attr(skb, cl) < 0)
                goto rtattr_failure;
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
index 5197b6caaf2de9aa4e215f5e8eef75dca2b5d4d5..80e6f811e3bc5ac9da752d5ec5c6e5906a141d20 100644 (file)
@@ -1363,7 +1363,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
                struct tcmsg *tcm)
 {
        struct hfsc_class *cl = (struct hfsc_class *)arg;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta = (struct rtattr *)b;
 
        tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT;
@@ -1374,7 +1374,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        if (hfsc_dump_curves(skb, cl) < 0)
                goto rtattr_failure;
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
  rtattr_failure:
@@ -1576,7 +1576,7 @@ static int
 hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct hfsc_sched *q = qdisc_priv(sch);
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_hfsc_qopt qopt;
 
        qopt.defcls = q->defcls;
index f76c20c0a109187d7da773f81a2f772788ca25c4..c687388a8cb6a6e7d8676618f131235be16a7e0a 100644 (file)
@@ -1110,7 +1110,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt)
 static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct htb_sched *q = qdisc_priv(sch);
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
        struct tc_htb_glob gopt;
        spin_lock_bh(&sch->dev->queue_lock);
@@ -1123,12 +1123,12 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
        rta = (struct rtattr *)b;
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt);
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        spin_unlock_bh(&sch->dev->queue_lock);
        return skb->len;
 rtattr_failure:
        spin_unlock_bh(&sch->dev->queue_lock);
-       skb_trim(skb, skb->tail - skb->data);
+       skb_trim(skb, skb_tail_pointer(skb) - skb->data);
        return -1;
 }
 
@@ -1136,7 +1136,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
                          struct sk_buff *skb, struct tcmsg *tcm)
 {
        struct htb_class *cl = (struct htb_class *)arg;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
        struct tc_htb_opt opt;
 
@@ -1159,7 +1159,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
        opt.prio = cl->un.leaf.prio;
        opt.level = cl->level;
        RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt);
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        spin_unlock_bh(&sch->dev->queue_lock);
        return skb->len;
 rtattr_failure:
index cfe070ee6ee33d2f62cfe0c09783d9389b3bfc63..d19f4070c2375dca58dd1ba294e5b95781957242 100644 (file)
@@ -362,12 +362,12 @@ static void ingress_destroy(struct Qdisc *sch)
 
 static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        rta = (struct rtattr *) b;
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
index 915f82a2cc3dc235b0244a26d8dd693a2ab2c784..2a9b1e429ff8567a1e64b57d1f6be95cb862aadc 100644 (file)
@@ -583,7 +583,7 @@ static void netem_destroy(struct Qdisc *sch)
 static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        const struct netem_sched_data *q = qdisc_priv(sch);
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta = (struct rtattr *) b;
        struct tc_netem_qopt qopt;
        struct tc_netem_corr cor;
@@ -611,7 +611,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
        corrupt.correlation = q->corrupt_cor.rho;
        RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
 
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
 
        return skb->len;
 
index de889f23f22a5fdb29481c6696957e0832f95170..5b371109ec1cdf5fe80cf24e4e53f9ee60018af8 100644 (file)
@@ -271,7 +271,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt)
 static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct prio_sched_data *q = qdisc_priv(sch);
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_prio_qopt opt;
 
        opt.bands = q->bands;
index e3695407afc6247380f12b72e92cad1a543f632b..a511ba83e26f8045b2ba35f6d9d34641a3595831 100644 (file)
@@ -461,7 +461,7 @@ static void sfq_destroy(struct Qdisc *sch)
 static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct sfq_sched_data *q = qdisc_priv(sch);
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_sfq_qopt opt;
 
        opt.quantum = q->quantum;
index f14692f3a14efeb9aed65b6f39264a0eeaa6f648..231895562c66056e4c3f2b72fe2ae5300a045e2a 100644 (file)
@@ -387,7 +387,7 @@ static void tbf_destroy(struct Qdisc *sch)
 static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct tbf_sched_data *q = qdisc_priv(sch);
-       unsigned char    *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
        struct tc_tbf_qopt opt;
 
@@ -403,7 +403,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
        opt.mtu = q->mtu;
        opt.buffer = q->buffer;
        RTA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt);
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
 
        return skb->len;
 
index 1ff47b18724a3e81f2ba9eb5b8aa95b0538e50dd..18b97eedc1fad86b1279d38245c3a92378fb3302 100644 (file)
@@ -612,7 +612,7 @@ int sctp_rcv_ootb(struct sk_buff *skb)
                        break;
 
                ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length));
-               if (ch_end > skb->tail)
+               if (ch_end > skb_tail_pointer(skb))
                        break;
 
                /* RFC 8.4, 2) If the OOTB packet contains an ABORT chunk, the
@@ -644,7 +644,7 @@ int sctp_rcv_ootb(struct sk_buff *skb)
                }
 
                ch = (sctp_chunkhdr_t *) ch_end;
-       } while (ch_end < skb->tail);
+       } while (ch_end < skb_tail_pointer(skb));
 
        return 0;
 
index c30629e177814cc1313f7a710999ffdfe67b873c..88aa2240754935522962a001088286516a8f8011 100644 (file)
@@ -159,16 +159,16 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
         * the skb->tail.
         */
        if (unlikely(skb_is_nonlinear(chunk->skb))) {
-               if (chunk->chunk_end > chunk->skb->tail)
-                       chunk->chunk_end = chunk->skb->tail;
+               if (chunk->chunk_end > skb_tail_pointer(chunk->skb))
+                       chunk->chunk_end = skb_tail_pointer(chunk->skb);
        }
        skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t));
        chunk->subh.v = NULL; /* Subheader is no longer valid.  */
 
-       if (chunk->chunk_end < chunk->skb->tail) {
+       if (chunk->chunk_end < skb_tail_pointer(chunk->skb)) {
                /* This is not a singleton */
                chunk->singleton = 0;
-       } else if (chunk->chunk_end > chunk->skb->tail) {
+       } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) {
                /* RFC 2960, Section 6.10  Bundling
                 *
                 * Partial chunks MUST NOT be placed in an SCTP packet.
index 60c5b59d4c65a891f8a8d5e93ceee4b1ca84163e..759ea3d19976a2ee712225137480f6f63717bf48 100644 (file)
@@ -1143,7 +1143,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
 
        /* Adjust the chunk length field.  */
        chunk->chunk_hdr->length = htons(chunklen + padlen + len);
-       chunk->chunk_end = chunk->skb->tail;
+       chunk->chunk_end = skb_tail_pointer(chunk->skb);
 
        return target;
 }
@@ -1168,7 +1168,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
        /* Adjust the chunk length field.  */
        chunk->chunk_hdr->length =
                htons(ntohs(chunk->chunk_hdr->length) + len);
-       chunk->chunk_end = chunk->skb->tail;
+       chunk->chunk_end = skb_tail_pointer(chunk->skb);
 
 out:
        return err;
index bf502c499c8153578a314f23495d871f906bfe86..438e5dc5c714dc4e256f44d26897cafee3ba58d0 100644 (file)
@@ -3115,7 +3115,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep,
                        break;
 
                ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length));
-               if (ch_end > skb->tail)
+               if (ch_end > skb_tail_pointer(skb))
                        break;
 
                if (SCTP_CID_SHUTDOWN_ACK == ch->type)
@@ -3130,7 +3130,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep,
                        return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
                ch = (sctp_chunkhdr_t *) ch_end;
-       } while (ch_end < skb->tail);
+       } while (ch_end < skb_tail_pointer(skb));
 
        if (ootb_shut_ack)
                sctp_sf_shut_8_4_5(ep, asoc, type, arg, commands);
index 14789a82de537b6629383ec37af4ec6d6b5c81dc..c71337a22d337acb9a8df8c6b0b1321f331d6935 100644 (file)
@@ -89,7 +89,7 @@ struct sk_buff *tipc_cfg_reply_alloc(int payload_size)
 int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
                        void *tlv_data, int tlv_data_size)
 {
-       struct tlv_desc *tlv = (struct tlv_desc *)buf->tail;
+       struct tlv_desc *tlv = (struct tlv_desc *)skb_tail_pointer(buf);
        int new_tlv_space = TLV_SPACE(tlv_data_size);
 
        if (skb_tailroom(buf) < new_tlv_space) {
index b71739fbe2c66cf588805bf99f6761695045f1b4..45832fb75ea45d813efe7a00b0320990e449c276 100644 (file)
@@ -1020,7 +1020,7 @@ restart:
 
        if (!err) {
                buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle);
-               sz = buf->tail - buf_crs;
+               sz = skb_tail_pointer(buf) - buf_crs;
 
                needed = (buf_len - sz_copied);
                sz_to_copy = (sz <= needed) ? sz : needed;
index 816e3690b60f4630cc2291c98cbc96559f01c48d..814bb3125adaa8f23844c2c1397b747d09c97ec8 100644 (file)
@@ -576,7 +576,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
        struct sk_buff *skb = sp->out_skb;
        struct xfrm_usersa_info *p;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        if (sp->this_idx < sp->start_idx)
                goto out;
@@ -621,7 +621,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
        if (x->lastused)
                RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 out:
        sp->this_idx++;
        return 0;
@@ -1157,7 +1157,7 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
        struct sk_buff *in_skb = sp->in_skb;
        struct sk_buff *skb = sp->out_skb;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        if (sp->this_idx < sp->start_idx)
                goto out;
@@ -1176,7 +1176,7 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
        if (copy_to_user_policy_type(xp->type, skb) < 0)
                goto nlmsg_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 out:
        sp->this_idx++;
        return 0;
@@ -1330,7 +1330,7 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
        struct xfrm_aevent_id *id;
        struct nlmsghdr *nlh;
        struct xfrm_lifetime_cur ltime;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_PUT(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id));
        id = NLMSG_DATA(nlh);
@@ -1362,7 +1362,7 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
                RTA_PUT(skb,XFRMA_ETIMER_THRESH,sizeof(u32),&etimer);
        }
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
@@ -1744,7 +1744,7 @@ static int build_migrate(struct sk_buff *skb, struct xfrm_migrate *m,
        struct xfrm_migrate *mp;
        struct xfrm_userpolicy_id *pol_id;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        int i;
 
        nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_MIGRATE, sizeof(*pol_id));
@@ -1764,7 +1764,7 @@ static int build_migrate(struct sk_buff *skb, struct xfrm_migrate *m,
                        goto nlmsg_failure;
        }
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 nlmsg_failure:
        skb_trim(skb, b - skb->data);
@@ -1942,7 +1942,7 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
 {
        struct xfrm_user_expire *ue;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_EXPIRE,
                        sizeof(*ue));
@@ -1952,7 +1952,7 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
        copy_to_user_state(x, &ue->state);
        ue->hard = (c->data.hard != 0) ? 1 : 0;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -1999,7 +1999,7 @@ static int xfrm_notify_sa_flush(struct km_event *c)
        struct xfrm_usersa_flush *p;
        struct nlmsghdr *nlh;
        struct sk_buff *skb;
-       unsigned char *b;
+       sk_buff_data_t b;
        int len = NLMSG_LENGTH(sizeof(struct xfrm_usersa_flush));
 
        skb = alloc_skb(len, GFP_ATOMIC);
@@ -2045,7 +2045,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, struct km_event *c)
        struct xfrm_usersa_id *id;
        struct nlmsghdr *nlh;
        struct sk_buff *skb;
-       unsigned char *b;
+       sk_buff_data_t b;
        int len = xfrm_sa_len(x);
        int headlen;
 
@@ -2129,7 +2129,7 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
 {
        struct xfrm_user_acquire *ua;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        __u32 seq = xfrm_get_acqseq();
 
        nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_ACQUIRE,
@@ -2153,7 +2153,7 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
        if (copy_to_user_policy_type(xp->type, skb) < 0)
                goto nlmsg_failure;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -2249,7 +2249,7 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp,
        struct xfrm_user_polexpire *upe;
        struct nlmsghdr *nlh;
        int hard = c->data.hard;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe));
        upe = NLMSG_DATA(nlh);
@@ -2264,7 +2264,7 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp,
                goto nlmsg_failure;
        upe->hard = !!hard;
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
@@ -2300,7 +2300,7 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *
        struct xfrm_userpolicy_id *id;
        struct nlmsghdr *nlh;
        struct sk_buff *skb;
-       unsigned char *b;
+       sk_buff_data_t b;
        int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
        int headlen;
 
@@ -2357,7 +2357,7 @@ static int xfrm_notify_policy_flush(struct km_event *c)
 {
        struct nlmsghdr *nlh;
        struct sk_buff *skb;
-       unsigned char *b;
+       sk_buff_data_t b;
        int len = 0;
 #ifdef CONFIG_XFRM_SUB_POLICY
        len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
@@ -2410,7 +2410,7 @@ static int build_report(struct sk_buff *skb, u8 proto,
 {
        struct xfrm_user_report *ur;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
 
        nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_REPORT, sizeof(*ur));
        ur = NLMSG_DATA(nlh);
@@ -2422,7 +2422,7 @@ static int build_report(struct sk_buff *skb, u8 proto,
        if (addr)
                RTA_PUT(skb, XFRMA_COADDR, sizeof(*addr), addr);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
index e203883406dd662bda61e5f9a55c5d1bcbbdbeeb..33f2e064a6822177cad15d3844923a668daef0b5 100644 (file)
@@ -66,7 +66,7 @@ static void selnl_add_payload(struct nlmsghdr *nlh, int len, int msgtype, void *
 static void selnl_notify(int msgtype, void *data)
 {
        int len;
-       unsigned char *tmp;
+       sk_buff_data_t tmp;
        struct sk_buff *skb;
        struct nlmsghdr *nlh;