diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-19 23:29:13 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:28 -0400 |
commit | 27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 (patch) | |
tree | 5a267e40f9b94014be38dad5de0a52b6628834e0 | |
parent | be8bd86321fa7f06359d866ef61fb4d2f3e9dce9 (diff) |
[SK_BUFF]: Convert skb->tail to sk_buff_data_t
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, 396 insertions, 329 deletions
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c index 68d59d912c99..eb416c95967d 100644 --- a/arch/ia64/sn/kernel/xpnet.c +++ b/arch/ia64/sn/kernel/xpnet.c | |||
@@ -264,7 +264,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | |||
264 | 264 | ||
265 | dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 265 | dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
266 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 266 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, |
267 | (void *) skb->data, (void *) skb->tail, (void *) skb->end, | 267 | (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, |
268 | skb->len); | 268 | skb->len); |
269 | 269 | ||
270 | skb->protocol = eth_type_trans(skb, xpnet_device); | 270 | skb->protocol = eth_type_trans(skb, xpnet_device); |
@@ -272,7 +272,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | |||
272 | 272 | ||
273 | dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " | 273 | dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " |
274 | "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", | 274 | "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", |
275 | (void *) skb->head, (void *) skb->data, (void *) skb->tail, | 275 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), |
276 | (void *) skb->end, skb->len); | 276 | (void *) skb->end, skb->len); |
277 | 277 | ||
278 | 278 | ||
@@ -475,7 +475,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
475 | 475 | ||
476 | dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 476 | dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
477 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 477 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, |
478 | (void *) skb->data, (void *) skb->tail, (void *) skb->end, | 478 | (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, |
479 | skb->len); | 479 | skb->len); |
480 | 480 | ||
481 | 481 | ||
@@ -497,7 +497,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
497 | 497 | ||
498 | /* get the beginning of the first cacheline and end of last */ | 498 | /* get the beginning of the first cacheline and end of last */ |
499 | start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1)); | 499 | start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1)); |
500 | end_addr = L1_CACHE_ALIGN((u64) skb->tail); | 500 | end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb)); |
501 | 501 | ||
502 | /* calculate how many bytes to embed in the XPC message */ | 502 | /* calculate how many bytes to embed in the XPC message */ |
503 | embedded_bytes = 0; | 503 | embedded_bytes = 0; |
@@ -573,7 +573,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
573 | msg->magic = XPNET_MAGIC; | 573 | msg->magic = XPNET_MAGIC; |
574 | msg->size = end_addr - start_addr; | 574 | msg->size = end_addr - start_addr; |
575 | msg->leadin_ignore = (u64) skb->data - start_addr; | 575 | msg->leadin_ignore = (u64) skb->data - start_addr; |
576 | msg->tailout_ignore = end_addr - (u64) skb->tail; | 576 | msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); |
577 | msg->buf_pa = __pa(start_addr); | 577 | msg->buf_pa = __pa(start_addr); |
578 | 578 | ||
579 | dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" | 579 | dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" |
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 8510026b690a..d33aba6864c2 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -1901,13 +1901,13 @@ he_service_rbrq(struct he_dev *he_dev, int group) | |||
1901 | case ATM_AAL0: | 1901 | case ATM_AAL0: |
1902 | /* 2.10.1.5 raw cell receive */ | 1902 | /* 2.10.1.5 raw cell receive */ |
1903 | skb->len = ATM_AAL0_SDU; | 1903 | skb->len = ATM_AAL0_SDU; |
1904 | skb->tail = skb->data + skb->len; | 1904 | skb_set_tail_pointer(skb, skb->len); |
1905 | break; | 1905 | break; |
1906 | case ATM_AAL5: | 1906 | case ATM_AAL5: |
1907 | /* 2.10.1.2 aal5 receive */ | 1907 | /* 2.10.1.2 aal5 receive */ |
1908 | 1908 | ||
1909 | skb->len = AAL5_LEN(skb->data, he_vcc->pdu_len); | 1909 | skb->len = AAL5_LEN(skb->data, he_vcc->pdu_len); |
1910 | skb->tail = skb->data + skb->len; | 1910 | skb_set_tail_pointer(skb, skb->len); |
1911 | #ifdef USE_CHECKSUM_HW | 1911 | #ifdef USE_CHECKSUM_HW |
1912 | if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) { | 1912 | if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) { |
1913 | skb->ip_summed = CHECKSUM_COMPLETE; | 1913 | skb->ip_summed = CHECKSUM_COMPLETE; |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index b4b80140c398..1e49799cd6cf 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -1816,7 +1816,8 @@ push_rx_skb(struct idt77252_dev *card, struct sk_buff *skb, int queue) | |||
1816 | u32 handle; | 1816 | u32 handle; |
1817 | u32 addr; | 1817 | u32 addr; |
1818 | 1818 | ||
1819 | skb->data = skb->tail = skb->head; | 1819 | skb->data = skb->head; |
1820 | skb_reset_tail_pointer(skb); | ||
1820 | skb->len = 0; | 1821 | skb->len = 0; |
1821 | 1822 | ||
1822 | skb_reserve(skb, 16); | 1823 | skb_reserve(skb, 16); |
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index aab9b3733d52..26f4b7033494 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c | |||
@@ -2208,7 +2208,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2208 | if (i == 1 && ns_rsqe_eopdu(rsqe)) | 2208 | if (i == 1 && ns_rsqe_eopdu(rsqe)) |
2209 | *((u32 *) sb->data) |= 0x00000002; | 2209 | *((u32 *) sb->data) |= 0x00000002; |
2210 | skb_put(sb, NS_AAL0_HEADER); | 2210 | skb_put(sb, NS_AAL0_HEADER); |
2211 | memcpy(sb->tail, cell, ATM_CELL_PAYLOAD); | 2211 | memcpy(skb_tail_pointer(sb), cell, ATM_CELL_PAYLOAD); |
2212 | skb_put(sb, ATM_CELL_PAYLOAD); | 2212 | skb_put(sb, ATM_CELL_PAYLOAD); |
2213 | ATM_SKB(sb)->vcc = vcc; | 2213 | ATM_SKB(sb)->vcc = vcc; |
2214 | __net_timestamp(sb); | 2214 | __net_timestamp(sb); |
@@ -2252,7 +2252,8 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2252 | vc->rx_iov = iovb; | 2252 | vc->rx_iov = iovb; |
2253 | NS_SKB(iovb)->iovcnt = 0; | 2253 | NS_SKB(iovb)->iovcnt = 0; |
2254 | iovb->len = 0; | 2254 | iovb->len = 0; |
2255 | iovb->tail = iovb->data = iovb->head; | 2255 | iovb->data = iovb->head; |
2256 | skb_reset_tail_pointer(iovb); | ||
2256 | NS_SKB(iovb)->vcc = vcc; | 2257 | NS_SKB(iovb)->vcc = vcc; |
2257 | /* IMPORTANT: a pointer to the sk_buff containing the small or large | 2258 | /* IMPORTANT: a pointer to the sk_buff containing the small or large |
2258 | buffer is stored as iovec base, NOT a pointer to the | 2259 | 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) | |||
2265 | recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS); | 2266 | recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS); |
2266 | NS_SKB(iovb)->iovcnt = 0; | 2267 | NS_SKB(iovb)->iovcnt = 0; |
2267 | iovb->len = 0; | 2268 | iovb->len = 0; |
2268 | iovb->tail = iovb->data = iovb->head; | 2269 | iovb->data = iovb->head; |
2270 | skb_reset_tail_pointer(iovb); | ||
2269 | NS_SKB(iovb)->vcc = vcc; | 2271 | NS_SKB(iovb)->vcc = vcc; |
2270 | } | 2272 | } |
2271 | iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++]; | 2273 | iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++]; |
@@ -2489,7 +2491,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | |||
2489 | { | 2491 | { |
2490 | lb = (struct sk_buff *) iov->iov_base; | 2492 | lb = (struct sk_buff *) iov->iov_base; |
2491 | tocopy = min_t(int, remaining, iov->iov_len); | 2493 | tocopy = min_t(int, remaining, iov->iov_len); |
2492 | memcpy(hb->tail, lb->data, tocopy); | 2494 | memcpy(skb_tail_pointer(hb), lb->data, tocopy); |
2493 | skb_put(hb, tocopy); | 2495 | skb_put(hb, tocopy); |
2494 | iov++; | 2496 | iov++; |
2495 | remaining -= tocopy; | 2497 | remaining -= tocopy; |
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c index 7698feafa6a7..58bc272bd407 100644 --- a/drivers/infiniband/hw/amso1100/c2.c +++ b/drivers/infiniband/hw/amso1100/c2.c | |||
@@ -439,7 +439,8 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem) | |||
439 | } | 439 | } |
440 | 440 | ||
441 | /* Setup the skb for reuse since we're dropping this pkt */ | 441 | /* Setup the skb for reuse since we're dropping this pkt */ |
442 | elem->skb->tail = elem->skb->data = elem->skb->head; | 442 | elem->skb->data = elem->skb->head; |
443 | skb_reset_tail_pointer(elem->skb); | ||
443 | 444 | ||
444 | /* Zero out the rxp hdr in the sk_buff */ | 445 | /* Zero out the rxp hdr in the sk_buff */ |
445 | memset(elem->skb->data, 0, sizeof(*rxp_hdr)); | 446 | memset(elem->skb->data, 0, sizeof(*rxp_hdr)); |
@@ -521,7 +522,7 @@ static void c2_rx_interrupt(struct net_device *netdev) | |||
521 | * "sizeof(struct c2_rxp_hdr)". | 522 | * "sizeof(struct c2_rxp_hdr)". |
522 | */ | 523 | */ |
523 | skb->data += sizeof(*rxp_hdr); | 524 | skb->data += sizeof(*rxp_hdr); |
524 | skb->tail = skb->data + buflen; | 525 | skb_set_tail_pointer(skb, buflen); |
525 | skb->len = buflen; | 526 | skb->len = buflen; |
526 | skb->protocol = eth_type_trans(skb, netdev); | 527 | skb->protocol = eth_type_trans(skb, netdev); |
527 | 528 | ||
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index cd3b1fa4a414..aa83277aba74 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -881,7 +881,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | |||
881 | 881 | ||
882 | addinfo[0] = '\0'; | 882 | addinfo[0] = '\0'; |
883 | /* This check stolen from 2.1.72 dev_queue_xmit_nit() */ | 883 | /* This check stolen from 2.1.72 dev_queue_xmit_nit() */ |
884 | if (p < skb->data || p >= skb->tail) { | 884 | if (p < skb->data || skb->network_header >= skb->tail) { |
885 | /* fall back to old isdn_net_log_packet method() */ | 885 | /* fall back to old isdn_net_log_packet method() */ |
886 | char * buf = skb->data; | 886 | char * buf = skb->data; |
887 | 887 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index c6b004182d91..9de177a5b9f1 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -600,6 +600,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
600 | /* Check CRC32, we've got it in our skb already. */ | 600 | /* Check CRC32, we've got it in our skb already. */ |
601 | unsigned short ulen = htons(priv->ule_sndu_len); | 601 | unsigned short ulen = htons(priv->ule_sndu_len); |
602 | unsigned short utype = htons(priv->ule_sndu_type); | 602 | unsigned short utype = htons(priv->ule_sndu_type); |
603 | const u8 *tail; | ||
603 | struct kvec iov[3] = { | 604 | struct kvec iov[3] = { |
604 | { &ulen, sizeof ulen }, | 605 | { &ulen, sizeof ulen }, |
605 | { &utype, sizeof utype }, | 606 | { &utype, sizeof utype }, |
@@ -613,10 +614,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
613 | } | 614 | } |
614 | 615 | ||
615 | ule_crc = iov_crc32(ule_crc, iov, 3); | 616 | ule_crc = iov_crc32(ule_crc, iov, 3); |
616 | expected_crc = *((u8 *)priv->ule_skb->tail - 4) << 24 | | 617 | tail = skb_tail_pointer(priv->ule_skb); |
617 | *((u8 *)priv->ule_skb->tail - 3) << 16 | | 618 | expected_crc = *(tail - 4) << 24 | |
618 | *((u8 *)priv->ule_skb->tail - 2) << 8 | | 619 | *(tail - 3) << 16 | |
619 | *((u8 *)priv->ule_skb->tail - 1); | 620 | *(tail - 2) << 8 | |
621 | *(tail - 1); | ||
620 | if (ule_crc != expected_crc) { | 622 | if (ule_crc != expected_crc) { |
621 | printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", | 623 | printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", |
622 | 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); | 624 | 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); |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 98643801a3b0..7feb9c561147 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1348,7 +1348,7 @@ e100_rx(struct net_device *dev) | |||
1348 | 1348 | ||
1349 | #ifdef ETHDEBUG | 1349 | #ifdef ETHDEBUG |
1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", | 1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", |
1351 | skb->head, skb->data, skb->tail, skb->end); | 1351 | skb->head, skb->data, skb_tail_pointer(skb), skb->end); |
1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); | 1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); |
1353 | #endif | 1353 | #endif |
1354 | 1354 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 610e4769efa4..c5faf1380e15 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -1325,13 +1325,13 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | |||
1325 | flits = skb_transport_offset(skb) / 8; | 1325 | flits = skb_transport_offset(skb) / 8; |
1326 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1326 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
1327 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), | 1327 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), |
1328 | skb->tail - skb_transport_header(skb), | 1328 | skb->tail - skb->transport_header, |
1329 | adap->pdev); | 1329 | adap->pdev); |
1330 | if (need_skb_unmap()) { | 1330 | if (need_skb_unmap()) { |
1331 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 1331 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); |
1332 | skb->destructor = deferred_unmap_destructor; | 1332 | skb->destructor = deferred_unmap_destructor; |
1333 | ((struct unmap_info *)skb->cb)->len = (skb->tail - | 1333 | ((struct unmap_info *)skb->cb)->len = (skb->tail - |
1334 | skb_transport_header(skb)); | 1334 | skb->transport_header); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, | 1337 | 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) | |||
1353 | return 1; /* packet fits as immediate data */ | 1353 | return 1; /* packet fits as immediate data */ |
1354 | 1354 | ||
1355 | flits = skb_transport_offset(skb) / 8; /* headers */ | 1355 | flits = skb_transport_offset(skb) / 8; /* headers */ |
1356 | if (skb->tail != skb_transport_header(skb)) | 1356 | if (skb->tail != skb->transport_header) |
1357 | cnt++; | 1357 | cnt++; |
1358 | return flits_to_desc(flits + sgl_len(cnt)); | 1358 | return flits_to_desc(flits + sgl_len(cnt)); |
1359 | } | 1359 | } |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index e86deb2ef823..e7c93f44f810 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3304,7 +3304,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3304 | * NOTE: this is a TSO only workaround | 3304 | * NOTE: this is a TSO only workaround |
3305 | * if end byte alignment not correct move us | 3305 | * if end byte alignment not correct move us |
3306 | * into the next dword */ | 3306 | * into the next dword */ |
3307 | if ((unsigned long)(skb->tail - 1) & 4) | 3307 | if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4) |
3308 | break; | 3308 | break; |
3309 | /* fall through */ | 3309 | /* fall through */ |
3310 | case e1000_82571: | 3310 | case e1000_82571: |
@@ -4388,7 +4388,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
4388 | PCI_DMA_FROMDEVICE); | 4388 | PCI_DMA_FROMDEVICE); |
4389 | vaddr = kmap_atomic(ps_page->ps_page[0], | 4389 | vaddr = kmap_atomic(ps_page->ps_page[0], |
4390 | KM_SKB_DATA_SOFTIRQ); | 4390 | KM_SKB_DATA_SOFTIRQ); |
4391 | memcpy(skb->tail, vaddr, l1); | 4391 | memcpy(skb_tail_pointer(skb), vaddr, l1); |
4392 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 4392 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
4393 | pci_dma_sync_single_for_device(pdev, | 4393 | pci_dma_sync_single_for_device(pdev, |
4394 | ps_page_dma->ps_page_dma[0], | 4394 | ps_page_dma->ps_page_dma[0], |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index b1ad62d89eb9..3d82d46f4998 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -1338,7 +1338,7 @@ static inline int emac_rx_sg_append(struct ocp_enet_private *dev, int slot) | |||
1338 | dev_kfree_skb(dev->rx_sg_skb); | 1338 | dev_kfree_skb(dev->rx_sg_skb); |
1339 | dev->rx_sg_skb = NULL; | 1339 | dev->rx_sg_skb = NULL; |
1340 | } else { | 1340 | } else { |
1341 | cacheable_memcpy(dev->rx_sg_skb->tail, | 1341 | cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb), |
1342 | dev->rx_skb[slot]->data, len); | 1342 | dev->rx_skb[slot]->data, len); |
1343 | skb_put(dev->rx_sg_skb, len); | 1343 | skb_put(dev->rx_sg_skb, len); |
1344 | emac_recycle_rx_skb(dev, slot, len); | 1344 | emac_recycle_rx_skb(dev, slot, len); |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0c3649be0d05..98bf51afcee7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -575,7 +575,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
575 | int i; | 575 | int i; |
576 | dev_dbg(&bp->pdev->dev, | 576 | dev_dbg(&bp->pdev->dev, |
577 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 577 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
578 | skb->len, skb->head, skb->data, skb->tail, skb->end); | 578 | skb->len, skb->head, skb->data, |
579 | skb_tail_pointer(skb), skb->end); | ||
579 | dev_dbg(&bp->pdev->dev, | 580 | dev_dbg(&bp->pdev->dev, |
580 | "data:"); | 581 | "data:"); |
581 | for (i = 0; i < 16; i++) | 582 | for (i = 0; i < 16; i++) |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index ec0af65cd5d7..73da611fd536 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1185,7 +1185,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1185 | skb_reserve(skb, 2); | 1185 | skb_reserve(skb, 2); |
1186 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); | 1186 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); |
1187 | if (pkt_len & 1) | 1187 | if (pkt_len & 1) |
1188 | *(skb->tail-1) = inb(ioaddr + AM2150_RCV); | 1188 | *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); |
1189 | skb->protocol = eth_type_trans(skb, dev); | 1189 | skb->protocol = eth_type_trans(skb, dev); |
1190 | 1190 | ||
1191 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ | 1191 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 46ebf141ee5a..600d3ff347fc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -2195,7 +2195,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | |||
2195 | frag_list->next = NULL; | 2195 | frag_list->next = NULL; |
2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); | 2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); |
2197 | frag_list->data = tmp; | 2197 | frag_list->data = tmp; |
2198 | frag_list->tail = tmp; | 2198 | skb_reset_tail_pointer(frag_list); |
2199 | 2199 | ||
2200 | /* Buffer-2 receives L4 data payload */ | 2200 | /* Buffer-2 receives L4 data payload */ |
2201 | ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | 2201 | ((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) | |||
2349 | tmp += ALIGN_SIZE; | 2349 | tmp += ALIGN_SIZE; |
2350 | tmp &= ~ALIGN_SIZE; | 2350 | tmp &= ~ALIGN_SIZE; |
2351 | skb->data = (void *) (unsigned long)tmp; | 2351 | skb->data = (void *) (unsigned long)tmp; |
2352 | skb->tail = (void *) (unsigned long)tmp; | 2352 | skb_reset_tail_pointer(skb); |
2353 | 2353 | ||
2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) | 2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) |
2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = | 2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 9a5850fa644a..e46f4cb02c15 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -829,7 +829,9 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
829 | != NULL) ) { | 829 | != NULL) ) { |
830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ | 830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ |
831 | skb_reserve(skb, 2); /* 16byte align */ | 831 | skb_reserve(skb, 2); /* 16byte align */ |
832 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); | 832 | memcpy(skb_put(skb, rxlen), |
833 | skb_tail_pointer(rxptr->rx_skb_ptr), | ||
834 | rxlen); | ||
833 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); | 835 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); |
834 | } else | 836 | } else |
835 | skb_put(skb, rxlen); | 837 | skb_put(skb, rxlen); |
@@ -1175,7 +1177,10 @@ static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * sk | |||
1175 | 1177 | ||
1176 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | 1178 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { |
1177 | rxptr->rx_skb_ptr = skb; | 1179 | rxptr->rx_skb_ptr = skb; |
1178 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1180 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1181 | skb_tail_pointer(skb), | ||
1182 | RX_ALLOC_SIZE, | ||
1183 | PCI_DMA_FROMDEVICE)); | ||
1179 | wmb(); | 1184 | wmb(); |
1180 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1185 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1181 | db->rx_avail_cnt++; | 1186 | db->rx_avail_cnt++; |
@@ -1339,7 +1344,10 @@ static void allocate_rx_buffer(struct uli526x_board_info *db) | |||
1339 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | 1344 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) |
1340 | break; | 1345 | break; |
1341 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | 1346 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ |
1342 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1347 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1348 | skb_tail_pointer(skb), | ||
1349 | RX_ALLOC_SIZE, | ||
1350 | PCI_DMA_FROMDEVICE)); | ||
1343 | wmb(); | 1351 | wmb(); |
1344 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1352 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1345 | rxptr = rxptr->next_rx_desc; | 1353 | rxptr = rxptr->next_rx_desc; |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index b747228c7198..aeb2789adf26 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -533,7 +533,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) | |||
533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); | 533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); |
534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); | 534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); |
535 | } | 535 | } |
536 | data = skb->tail; | 536 | data = skb_tail_pointer(skb); |
537 | data[i++] = LMI_CALLREF; | 537 | data[i++] = LMI_CALLREF; |
538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; | 538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; |
539 | if (lmi == LMI_ANSI) | 539 | if (lmi == LMI_ANSI) |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index d4851465c83b..b731f3aae0df 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1636,7 +1636,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1636 | if (nsb) { | 1636 | if (nsb) { |
1637 | sc->lmc_rxq[i] = nsb; | 1637 | sc->lmc_rxq[i] = nsb; |
1638 | nsb->dev = dev; | 1638 | nsb->dev = dev; |
1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1640 | } | 1640 | } |
1641 | sc->failed_recv_alloc = 1; | 1641 | sc->failed_recv_alloc = 1; |
1642 | goto skip_packet; | 1642 | goto skip_packet; |
@@ -1679,7 +1679,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1679 | if (nsb) { | 1679 | if (nsb) { |
1680 | sc->lmc_rxq[i] = nsb; | 1680 | sc->lmc_rxq[i] = nsb; |
1681 | nsb->dev = dev; | 1681 | nsb->dev = dev; |
1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1683 | /* Transferred to 21140 below */ | 1683 | /* Transferred to 21140 below */ |
1684 | } | 1684 | } |
1685 | else { | 1685 | else { |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 35a3a50724fe..5e3e9e262706 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -922,7 +922,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
922 | if (frag != 0) | 922 | if (frag != 0) |
923 | flen -= hdrlen; | 923 | flen -= hdrlen; |
924 | 924 | ||
925 | if (frag_skb->tail + flen > frag_skb->end) { | 925 | if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { |
926 | printk(KERN_WARNING "%s: host decrypted and " | 926 | printk(KERN_WARNING "%s: host decrypted and " |
927 | "reassembled frame did not fit skb\n", | 927 | "reassembled frame did not fit skb\n", |
928 | dev->name); | 928 | dev->name); |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index 787c01317042..54e3f806cd52 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -706,7 +706,8 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg) | |||
706 | spin_unlock(&ch->collect_lock); | 706 | spin_unlock(&ch->collect_lock); |
707 | return; | 707 | return; |
708 | } | 708 | } |
709 | ch->trans_skb->tail = ch->trans_skb->data = ch->trans_skb_data; | 709 | ch->trans_skb->data = ch->trans_skb_data; |
710 | skb_reset_tail_pointer(ch->trans_skb); | ||
710 | ch->trans_skb->len = 0; | 711 | ch->trans_skb->len = 0; |
711 | if (ch->prof.maxmulti < (ch->collect_len + 2)) | 712 | if (ch->prof.maxmulti < (ch->collect_len + 2)) |
712 | ch->prof.maxmulti = ch->collect_len + 2; | 713 | ch->prof.maxmulti = ch->collect_len + 2; |
@@ -831,7 +832,8 @@ ch_action_rx(fsm_instance * fi, int event, void *arg) | |||
831 | ctc_unpack_skb(ch, skb); | 832 | ctc_unpack_skb(ch, skb); |
832 | } | 833 | } |
833 | again: | 834 | again: |
834 | skb->data = skb->tail = ch->trans_skb_data; | 835 | skb->data = ch->trans_skb_data; |
836 | skb_reset_tail_pointer(skb); | ||
835 | skb->len = 0; | 837 | skb->len = 0; |
836 | if (ctc_checkalloc_buffer(ch, 1)) | 838 | if (ctc_checkalloc_buffer(ch, 1)) |
837 | return; | 839 | return; |
@@ -2226,7 +2228,8 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
2226 | * IDAL support in CTC is broken, so we have to | 2228 | * IDAL support in CTC is broken, so we have to |
2227 | * care about skb's above 2G ourselves. | 2229 | * care about skb's above 2G ourselves. |
2228 | */ | 2230 | */ |
2229 | hi = ((unsigned long) skb->tail + LL_HEADER_LENGTH) >> 31; | 2231 | hi = ((unsigned long)skb_tail_pointer(skb) + |
2232 | LL_HEADER_LENGTH) >> 31; | ||
2230 | if (hi) { | 2233 | if (hi) { |
2231 | nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 2234 | nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
2232 | if (!nskb) { | 2235 | if (!nskb) { |
@@ -2262,7 +2265,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
2262 | return -EBUSY; | 2265 | return -EBUSY; |
2263 | } | 2266 | } |
2264 | 2267 | ||
2265 | ch->trans_skb->tail = ch->trans_skb->data; | 2268 | skb_reset_tail_pointer(ch->trans_skb); |
2266 | ch->trans_skb->len = 0; | 2269 | ch->trans_skb->len = 0; |
2267 | ch->ccw[1].count = skb->len; | 2270 | ch->ccw[1].count = skb->len; |
2268 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, | 2271 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 82edf2014402..cd42bd54988c 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -689,7 +689,8 @@ static void conn_action_rx(fsm_instance *fi, int event, void *arg) | |||
689 | msg->length, conn->max_buffsize); | 689 | msg->length, conn->max_buffsize); |
690 | return; | 690 | return; |
691 | } | 691 | } |
692 | conn->rx_buff->data = conn->rx_buff->tail = conn->rx_buff->head; | 692 | conn->rx_buff->data = conn->rx_buff->head; |
693 | skb_reset_tail_pointer(conn->rx_buff); | ||
693 | conn->rx_buff->len = 0; | 694 | conn->rx_buff->len = 0; |
694 | rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, | 695 | rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, |
695 | msg->length, NULL); | 696 | msg->length, NULL); |
@@ -735,7 +736,8 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg) | |||
735 | } | 736 | } |
736 | } | 737 | } |
737 | } | 738 | } |
738 | conn->tx_buff->data = conn->tx_buff->tail = conn->tx_buff->head; | 739 | conn->tx_buff->data = conn->tx_buff->head; |
740 | skb_reset_tail_pointer(conn->tx_buff); | ||
739 | conn->tx_buff->len = 0; | 741 | conn->tx_buff->len = 0; |
740 | spin_lock_irqsave(&conn->collect_lock, saveflags); | 742 | spin_lock_irqsave(&conn->collect_lock, saveflags); |
741 | while ((skb = skb_dequeue(&conn->collect_queue))) { | 743 | while ((skb = skb_dequeue(&conn->collect_queue))) { |
@@ -1164,8 +1166,8 @@ static int netiucv_transmit_skb(struct iucv_connection *conn, | |||
1164 | * Copy the skb to a new allocated skb in lowmem only if the | 1166 | * Copy the skb to a new allocated skb in lowmem only if the |
1165 | * data is located above 2G in memory or tailroom is < 2. | 1167 | * data is located above 2G in memory or tailroom is < 2. |
1166 | */ | 1168 | */ |
1167 | unsigned long hi = | 1169 | unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) + |
1168 | ((unsigned long)(skb->tail + NETIUCV_HDRLEN)) >> 31; | 1170 | NETIUCV_HDRLEN)) >> 31; |
1169 | int copied = 0; | 1171 | int copied = 0; |
1170 | if (hi || (skb_tailroom(skb) < 2)) { | 1172 | if (hi || (skb_tailroom(skb) < 2)) { |
1171 | nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + | 1173 | nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index ec63b0ee0743..4d8f282b23d1 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -335,15 +335,15 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
335 | 335 | ||
336 | sarb = instance->cached_vcc->sarb; | 336 | sarb = instance->cached_vcc->sarb; |
337 | 337 | ||
338 | if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { | 338 | if (skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD > sarb->end) { |
339 | atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | 339 | atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", |
340 | __func__, sarb->len, vcc); | 340 | __func__, sarb->len, vcc); |
341 | /* discard cells already received */ | 341 | /* discard cells already received */ |
342 | skb_trim(sarb, 0); | 342 | skb_trim(sarb, 0); |
343 | UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); | 343 | UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end); |
344 | } | 344 | } |
345 | 345 | ||
346 | memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | 346 | memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); |
347 | __skb_put(sarb, ATM_CELL_PAYLOAD); | 347 | __skb_put(sarb, ATM_CELL_PAYLOAD); |
348 | 348 | ||
349 | if (pti & 1) { | 349 | if (pti & 1) { |
@@ -370,7 +370,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
370 | goto out; | 370 | goto out; |
371 | } | 371 | } |
372 | 372 | ||
373 | if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { | 373 | if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) { |
374 | atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", | 374 | atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", |
375 | __func__, vcc); | 375 | __func__, vcc); |
376 | atomic_inc(&vcc->stats->rx_err); | 376 | atomic_inc(&vcc->stats->rx_err); |
@@ -396,7 +396,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
396 | goto out; /* atm_charge increments rx_drop */ | 396 | goto out; /* atm_charge increments rx_drop */ |
397 | } | 397 | } |
398 | 398 | ||
399 | memcpy(skb->data, sarb->tail - pdu_length, length); | 399 | memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length); |
400 | __skb_put(skb, length); | 400 | __skb_put(skb, length); |
401 | 401 | ||
402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | 402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", |
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 5808ea082459..f56e2dab3712 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -298,7 +298,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
298 | if (ax_skb) { | 298 | if (ax_skb) { |
299 | ax_skb->len = size; | 299 | ax_skb->len = size; |
300 | ax_skb->data = packet; | 300 | ax_skb->data = packet; |
301 | ax_skb->tail = packet + size; | 301 | skb_set_tail_pointer(ax_skb, size); |
302 | usbnet_skb_return(dev, ax_skb); | 302 | usbnet_skb_return(dev, ax_skb); |
303 | } else { | 303 | } else { |
304 | return 0; | 304 | return 0; |
@@ -338,7 +338,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
338 | && ((headroom + tailroom) >= (4 + padlen))) { | 338 | && ((headroom + tailroom) >= (4 + padlen))) { |
339 | if ((headroom < 4) || (tailroom < padlen)) { | 339 | if ((headroom < 4) || (tailroom < padlen)) { |
340 | skb->data = memmove(skb->head + 4, skb->data, skb->len); | 340 | skb->data = memmove(skb->head + 4, skb->data, skb->len); |
341 | skb->tail = skb->data + skb->len; | 341 | skb_set_tail_pointer(skb, skb->len); |
342 | } | 342 | } |
343 | } else { | 343 | } else { |
344 | struct sk_buff *skb2; | 344 | struct sk_buff *skb2; |
@@ -356,7 +356,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
356 | 356 | ||
357 | if ((skb->len % 512) == 0) { | 357 | if ((skb->len % 512) == 0) { |
358 | cpu_to_le32s(&padbytes); | 358 | cpu_to_le32s(&padbytes); |
359 | memcpy( skb->tail, &padbytes, sizeof(padbytes)); | 359 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
360 | skb_put(skb, sizeof(padbytes)); | 360 | skb_put(skb, sizeof(padbytes)); |
361 | } | 361 | } |
362 | return skb; | 362 | return skb; |
diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index d257a8e026d6..031cf5ca4dbb 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c | |||
@@ -157,7 +157,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | |||
157 | if ((headroom < (4 + 4*1)) || (tailroom < padlen)) { | 157 | if ((headroom < (4 + 4*1)) || (tailroom < padlen)) { |
158 | skb->data = memmove(skb->head + (4 + 4*1), | 158 | skb->data = memmove(skb->head + (4 + 4*1), |
159 | skb->data, skb->len); | 159 | skb->data, skb->len); |
160 | skb->tail = skb->data + skb->len; | 160 | skb_set_tail_pointer(skb, skb->len); |
161 | } | 161 | } |
162 | } else { | 162 | } else { |
163 | struct sk_buff *skb2; | 163 | struct sk_buff *skb2; |
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index ccebfdef4751..19bf8dae70c9 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c | |||
@@ -520,7 +520,7 @@ net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | |||
520 | skb->data = memmove(skb->head | 520 | skb->data = memmove(skb->head |
521 | + sizeof (struct nc_header), | 521 | + sizeof (struct nc_header), |
522 | skb->data, skb->len); | 522 | skb->data, skb->len); |
523 | skb->tail = skb->data + len; | 523 | skb_set_tail_pointer(skb, len); |
524 | goto encapsulate; | 524 | goto encapsulate; |
525 | } | 525 | } |
526 | } | 526 | } |
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index 39a21c74fdf4..1d36772ba6e1 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c | |||
@@ -588,7 +588,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | |||
588 | if (likely((sizeof *hdr) <= room)) { | 588 | if (likely((sizeof *hdr) <= room)) { |
589 | skb->data = memmove(skb->head + sizeof *hdr, | 589 | skb->data = memmove(skb->head + sizeof *hdr, |
590 | skb->data, len); | 590 | skb->data, len); |
591 | skb->tail = skb->data + len; | 591 | skb_set_tail_pointer(skb, len); |
592 | goto fill; | 592 | goto fill; |
593 | } | 593 | } |
594 | } | 594 | } |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 6179648a014e..e1ea5dfbbbd4 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -62,11 +62,11 @@ struct nfattr | |||
62 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | 62 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) |
63 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | 63 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) |
64 | #define NFA_NEST(skb, type) \ | 64 | #define NFA_NEST(skb, type) \ |
65 | ({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ | 65 | ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ |
66 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | 66 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ |
67 | __start; }) | 67 | __start; }) |
68 | #define NFA_NEST_END(skb, start) \ | 68 | #define NFA_NEST_END(skb, start) \ |
69 | ({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ | 69 | ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ |
70 | (skb)->len; }) | 70 | (skb)->len; }) |
71 | #define NFA_NEST_CANCEL(skb, start) \ | 71 | #define NFA_NEST_CANCEL(skb, start) \ |
72 | ({ if (start) \ | 72 | ({ if (start) \ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index a9d3ad5bc80f..68a632b372ec 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -229,7 +229,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
229 | (cb)->nlh->nlmsg_seq, type, len, flags) | 229 | (cb)->nlh->nlmsg_seq, type, len, flags) |
230 | 230 | ||
231 | #define NLMSG_END(skb, nlh) \ | 231 | #define NLMSG_END(skb, nlh) \ |
232 | ({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ | 232 | ({ (nlh)->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)(nlh); \ |
233 | (skb)->len; }) | 233 | (skb)->len; }) |
234 | 234 | ||
235 | #define NLMSG_CANCEL(skb, nlh) \ | 235 | #define NLMSG_CANCEL(skb, nlh) \ |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 4a629ea70cc4..3a4cb242ecd2 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -605,7 +605,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
605 | 605 | ||
606 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | 606 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ |
607 | ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ | 607 | ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ |
608 | memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ | 608 | memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \ |
609 | RTA_ALIGN(attrlen) - attrlen); }) | 609 | RTA_ALIGN(attrlen) - attrlen); }) |
610 | 610 | ||
611 | #define RTA_PUT_U8(skb, attrtype, value) \ | 611 | #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 | |||
637 | RTA_PUT(skb, attrtype, 0, NULL); | 637 | RTA_PUT(skb, attrtype, 0, NULL); |
638 | 638 | ||
639 | #define RTA_NEST(skb, type) \ | 639 | #define RTA_NEST(skb, type) \ |
640 | ({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ | 640 | ({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \ |
641 | RTA_PUT(skb, type, 0, NULL); \ | 641 | RTA_PUT(skb, type, 0, NULL); \ |
642 | __start; }) | 642 | __start; }) |
643 | 643 | ||
644 | #define RTA_NEST_END(skb, start) \ | 644 | #define RTA_NEST_END(skb, start) \ |
645 | ({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ | 645 | ({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ |
646 | (skb)->len; }) | 646 | (skb)->len; }) |
647 | 647 | ||
648 | #define RTA_NEST_CANCEL(skb, start) \ | 648 | #define RTA_NEST_CANCEL(skb, start) \ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 2e7405500626..e1c2392ecb56 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -246,9 +246,6 @@ struct sk_buff { | |||
246 | int iif; | 246 | int iif; |
247 | /* 4 byte hole on 64 bit*/ | 247 | /* 4 byte hole on 64 bit*/ |
248 | 248 | ||
249 | sk_buff_data_t transport_header; | ||
250 | sk_buff_data_t network_header; | ||
251 | sk_buff_data_t mac_header; | ||
252 | struct dst_entry *dst; | 249 | struct dst_entry *dst; |
253 | struct sec_path *sp; | 250 | struct sec_path *sp; |
254 | 251 | ||
@@ -303,13 +300,16 @@ struct sk_buff { | |||
303 | 300 | ||
304 | __u32 mark; | 301 | __u32 mark; |
305 | 302 | ||
303 | sk_buff_data_t transport_header; | ||
304 | sk_buff_data_t network_header; | ||
305 | sk_buff_data_t mac_header; | ||
306 | /* These elements must be at the end, see alloc_skb() for details. */ | 306 | /* These elements must be at the end, see alloc_skb() for details. */ |
307 | unsigned int truesize; | 307 | sk_buff_data_t tail; |
308 | atomic_t users; | ||
309 | unsigned char *head, | 308 | unsigned char *head, |
310 | *data, | 309 | *data, |
311 | *tail, | ||
312 | *end; | 310 | *end; |
311 | unsigned int truesize; | ||
312 | atomic_t users; | ||
313 | }; | 313 | }; |
314 | 314 | ||
315 | #ifdef __KERNEL__ | 315 | #ifdef __KERNEL__ |
@@ -812,12 +812,45 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
812 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 812 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) |
813 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 813 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
814 | 814 | ||
815 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
816 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
817 | { | ||
818 | return skb->head + skb->tail; | ||
819 | } | ||
820 | |||
821 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
822 | { | ||
823 | skb->tail = skb->data - skb->head; | ||
824 | } | ||
825 | |||
826 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
827 | { | ||
828 | skb_reset_tail_pointer(skb); | ||
829 | skb->tail += offset; | ||
830 | } | ||
831 | #else /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
832 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
833 | { | ||
834 | return skb->tail; | ||
835 | } | ||
836 | |||
837 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
838 | { | ||
839 | skb->tail = skb->data; | ||
840 | } | ||
841 | |||
842 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
843 | { | ||
844 | skb->tail = skb->data + offset; | ||
845 | } | ||
846 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
847 | |||
815 | /* | 848 | /* |
816 | * Add data to an sk_buff | 849 | * Add data to an sk_buff |
817 | */ | 850 | */ |
818 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | 851 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) |
819 | { | 852 | { |
820 | unsigned char *tmp = skb->tail; | 853 | unsigned char *tmp = skb_tail_pointer(skb); |
821 | SKB_LINEAR_ASSERT(skb); | 854 | SKB_LINEAR_ASSERT(skb); |
822 | skb->tail += len; | 855 | skb->tail += len; |
823 | skb->len += len; | 856 | skb->len += len; |
@@ -835,11 +868,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | |||
835 | */ | 868 | */ |
836 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | 869 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) |
837 | { | 870 | { |
838 | unsigned char *tmp = skb->tail; | 871 | unsigned char *tmp = skb_tail_pointer(skb); |
839 | SKB_LINEAR_ASSERT(skb); | 872 | SKB_LINEAR_ASSERT(skb); |
840 | skb->tail += len; | 873 | skb->tail += len; |
841 | skb->len += len; | 874 | skb->len += len; |
842 | if (unlikely(skb->tail>skb->end)) | 875 | if (unlikely(skb_tail_pointer(skb) > skb->end)) |
843 | skb_over_panic(skb, len, current_text_addr()); | 876 | skb_over_panic(skb, len, current_text_addr()); |
844 | return tmp; | 877 | return tmp; |
845 | } | 878 | } |
@@ -935,7 +968,7 @@ static inline int skb_headroom(const struct sk_buff *skb) | |||
935 | */ | 968 | */ |
936 | static inline int skb_tailroom(const struct sk_buff *skb) | 969 | static inline int skb_tailroom(const struct sk_buff *skb) |
937 | { | 970 | { |
938 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; | 971 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb); |
939 | } | 972 | } |
940 | 973 | ||
941 | /** | 974 | /** |
@@ -1127,8 +1160,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | |||
1127 | WARN_ON(1); | 1160 | WARN_ON(1); |
1128 | return; | 1161 | return; |
1129 | } | 1162 | } |
1130 | skb->len = len; | 1163 | skb->len = len; |
1131 | skb->tail = skb->data + len; | 1164 | skb_set_tail_pointer(skb, len); |
1132 | } | 1165 | } |
1133 | 1166 | ||
1134 | /** | 1167 | /** |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 06a2c69a89e5..de8399a79774 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -114,14 +114,12 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) | |||
114 | { | 114 | { |
115 | switch (skb->protocol) { | 115 | switch (skb->protocol) { |
116 | case __constant_htons(ETH_P_IP): | 116 | case __constant_htons(ETH_P_IP): |
117 | if (skb_network_header(skb) + sizeof(struct iphdr) <= | 117 | if (skb->network_header + sizeof(struct iphdr) <= skb->tail) |
118 | skb->tail) | ||
119 | return IP_ECN_set_ce(ip_hdr(skb)); | 118 | return IP_ECN_set_ce(ip_hdr(skb)); |
120 | break; | 119 | break; |
121 | 120 | ||
122 | case __constant_htons(ETH_P_IPV6): | 121 | case __constant_htons(ETH_P_IPV6): |
123 | if (skb_network_header(skb) + sizeof(struct ipv6hdr) <= | 122 | if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) |
124 | skb->tail) | ||
125 | return IP6_ECN_set_ce(ipv6_hdr(skb)); | 123 | return IP6_ECN_set_ce(ipv6_hdr(skb)); |
126 | break; | 124 | break; |
127 | } | 125 | } |
diff --git a/include/net/netlink.h b/include/net/netlink.h index bcaf67b7a19d..2c7ab107f20d 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) | |||
525 | */ | 525 | */ |
526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | 526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) |
527 | { | 527 | { |
528 | nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; | 528 | nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; |
529 | 529 | ||
530 | return skb->len; | 530 | return skb->len; |
531 | } | 531 | } |
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
538 | */ | 538 | */ |
539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) | 539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) |
540 | { | 540 | { |
541 | return skb->tail; | 541 | return skb_tail_pointer(skb); |
542 | } | 542 | } |
543 | 543 | ||
544 | /** | 544 | /** |
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla) | |||
940 | */ | 940 | */ |
941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | 941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) |
942 | { | 942 | { |
943 | struct nlattr *start = (struct nlattr *) skb->tail; | 943 | struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb); |
944 | 944 | ||
945 | if (nla_put(skb, attrtype, 0, NULL) < 0) | 945 | if (nla_put(skb, attrtype, 0, NULL) < 0) |
946 | return NULL; | 946 | return NULL; |
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | |||
960 | */ | 960 | */ |
961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | 961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) |
962 | { | 962 | { |
963 | start->nla_len = skb->tail - (unsigned char *) start; | 963 | start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start; |
964 | return skb->len; | 964 | return skb->len; |
965 | } | 965 | } |
966 | 966 | ||
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index dcb3a91f1364..4129df708079 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -337,7 +337,7 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer) | |||
337 | static inline int tcf_valid_offset(const struct sk_buff *skb, | 337 | static inline int tcf_valid_offset(const struct sk_buff *skb, |
338 | const unsigned char *ptr, const int len) | 338 | const unsigned char *ptr, const int len) |
339 | { | 339 | { |
340 | return unlikely((ptr + len) < skb->tail && ptr > skb->head); | 340 | return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head); |
341 | } | 341 | } |
342 | 342 | ||
343 | #ifdef CONFIG_NET_CLS_IND | 343 | #ifdef CONFIG_NET_CLS_IND |
diff --git a/kernel/audit.c b/kernel/audit.c index 76c9a11b72d6..ea8521417d13 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -1073,7 +1073,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | |||
1073 | goto out; | 1073 | goto out; |
1074 | } | 1074 | } |
1075 | va_copy(args2, args); | 1075 | va_copy(args2, args); |
1076 | len = vsnprintf(skb->tail, avail, fmt, args); | 1076 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args); |
1077 | if (len >= avail) { | 1077 | if (len >= avail) { |
1078 | /* The printk buffer is 1024 bytes long, so if we get | 1078 | /* The printk buffer is 1024 bytes long, so if we get |
1079 | * here and AUDIT_BUFSIZ is at least 1024, then we can | 1079 | * 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, | |||
1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | 1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); |
1083 | if (!avail) | 1083 | if (!avail) |
1084 | goto out; | 1084 | goto out; |
1085 | len = vsnprintf(skb->tail, avail, fmt, args2); | 1085 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2); |
1086 | } | 1086 | } |
1087 | if (len > 0) | 1087 | if (len > 0) |
1088 | skb_put(skb, len); | 1088 | skb_put(skb, len); |
@@ -1143,7 +1143,7 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf, | |||
1143 | return; | 1143 | return; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | ptr = skb->tail; | 1146 | ptr = skb_tail_pointer(skb); |
1147 | for (i=0; i<len; i++) { | 1147 | for (i=0; i<len; i++) { |
1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | 1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ |
1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ | 1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ |
@@ -1175,7 +1175,7 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen, | |||
1175 | if (!avail) | 1175 | if (!avail) |
1176 | return; | 1176 | return; |
1177 | } | 1177 | } |
1178 | ptr = skb->tail; | 1178 | ptr = skb_tail_pointer(skb); |
1179 | *ptr++ = '"'; | 1179 | *ptr++ = '"'; |
1180 | memcpy(ptr, string, slen); | 1180 | memcpy(ptr, string, slen); |
1181 | ptr += slen; | 1181 | ptr += slen; |
diff --git a/net/atm/lec.c b/net/atm/lec.c index d339645dc796..a8c6b285e06c 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -283,7 +283,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", | 285 | DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", |
286 | (long)skb->head, (long)skb->data, (long)skb->tail, | 286 | (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb), |
287 | (long)skb->end); | 287 | (long)skb->end); |
288 | #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) | 288 | #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) |
289 | if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) | 289 | if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 94f457360560..10cc13cfae6c 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -1567,7 +1567,7 @@ static int rfcomm_recv_frame(struct rfcomm_session *s, struct sk_buff *skb) | |||
1567 | 1567 | ||
1568 | /* Trim FCS */ | 1568 | /* Trim FCS */ |
1569 | skb->len--; skb->tail--; | 1569 | skb->len--; skb->tail--; |
1570 | fcs = *(u8 *) skb->tail; | 1570 | fcs = *(u8 *)skb_tail_pointer(skb); |
1571 | 1571 | ||
1572 | if (__check_fcs(skb->data, type, fcs)) { | 1572 | if (__check_fcs(skb->data, type, fcs)) { |
1573 | BT_ERR("bad checksum in packet"); | 1573 | BT_ERR("bad checksum in packet"); |
diff --git a/net/core/dev.c b/net/core/dev.c index 6562e5736e2f..86dc9f693f66 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1069,7 +1069,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | |||
1069 | skb_reset_mac_header(skb2); | 1069 | skb_reset_mac_header(skb2); |
1070 | 1070 | ||
1071 | if (skb_network_header(skb2) < skb2->data || | 1071 | if (skb_network_header(skb2) < skb2->data || |
1072 | skb_network_header(skb2) > skb2->tail) { | 1072 | skb2->network_header > skb2->tail) { |
1073 | if (net_ratelimit()) | 1073 | if (net_ratelimit()) |
1074 | printk(KERN_CRIT "protocol %04x is " | 1074 | printk(KERN_CRIT "protocol %04x is " |
1075 | "buggy, dev %s\n", | 1075 | "buggy, dev %s\n", |
@@ -1175,7 +1175,7 @@ int skb_checksum_help(struct sk_buff *skb) | |||
1175 | BUG_ON(offset > (int)skb->len); | 1175 | BUG_ON(offset > (int)skb->len); |
1176 | csum = skb_checksum(skb, offset, skb->len-offset, 0); | 1176 | csum = skb_checksum(skb, offset, skb->len-offset, 0); |
1177 | 1177 | ||
1178 | offset = skb->tail - skb_transport_header(skb); | 1178 | offset = skb->tail - skb->transport_header; |
1179 | BUG_ON(offset <= 0); | 1179 | BUG_ON(offset <= 0); |
1180 | BUG_ON(skb->csum_offset + 2 > offset); | 1180 | BUG_ON(skb->csum_offset + 2 > offset); |
1181 | 1181 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index d2358a5e6339..bd903aaf7aa7 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -46,7 +46,7 @@ static void *__load_pointer(struct sk_buff *skb, int k) | |||
46 | else if (k >= SKF_LL_OFF) | 46 | else if (k >= SKF_LL_OFF) |
47 | ptr = skb_mac_header(skb) + k - SKF_LL_OFF; | 47 | ptr = skb_mac_header(skb) + k - SKF_LL_OFF; |
48 | 48 | ||
49 | if (ptr >= skb->head && ptr < skb->tail) | 49 | if (ptr >= skb->head && ptr < skb_tail_pointer(skb)) |
50 | return ptr; | 50 | return ptr; |
51 | return NULL; | 51 | return NULL; |
52 | } | 52 | } |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index 259473d0559d..bcc25591d8ac 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -61,7 +61,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, | |||
61 | spin_lock_bh(lock); | 61 | spin_lock_bh(lock); |
62 | d->lock = lock; | 62 | d->lock = lock; |
63 | if (type) | 63 | if (type) |
64 | d->tail = (struct rtattr *) skb->tail; | 64 | d->tail = (struct rtattr *)skb_tail_pointer(skb); |
65 | d->skb = skb; | 65 | d->skb = skb; |
66 | d->compat_tc_stats = tc_stats_type; | 66 | d->compat_tc_stats = tc_stats_type; |
67 | d->compat_xstats = xstats_type; | 67 | d->compat_xstats = xstats_type; |
@@ -212,7 +212,7 @@ int | |||
212 | gnet_stats_finish_copy(struct gnet_dump *d) | 212 | gnet_stats_finish_copy(struct gnet_dump *d) |
213 | { | 213 | { |
214 | if (d->tail) | 214 | if (d->tail) |
215 | d->tail->rta_len = d->skb->tail - (u8 *) d->tail; | 215 | d->tail->rta_len = skb_tail_pointer(d->skb) - (u8 *)d->tail; |
216 | 216 | ||
217 | if (d->compat_tc_stats) | 217 | if (d->compat_tc_stats) |
218 | if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats, | 218 | if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats, |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 9da8357addcd..f9469ea530cc 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2357,7 +2357,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2357 | *vlan_encapsulated_proto = htons(ETH_P_IP); | 2357 | *vlan_encapsulated_proto = htons(ETH_P_IP); |
2358 | } | 2358 | } |
2359 | 2359 | ||
2360 | skb_set_network_header(skb, skb->tail - skb->data); | 2360 | skb->network_header = skb->tail; |
2361 | skb->transport_header = skb->network_header + sizeof(struct iphdr); | 2361 | skb->transport_header = skb->network_header + sizeof(struct iphdr); |
2362 | skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); | 2362 | skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); |
2363 | 2363 | ||
@@ -2696,7 +2696,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2696 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); | 2696 | *vlan_encapsulated_proto = htons(ETH_P_IPV6); |
2697 | } | 2697 | } |
2698 | 2698 | ||
2699 | skb_set_network_header(skb, skb->tail - skb->data); | 2699 | skb->network_header = skb->tail; |
2700 | skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); | 2700 | skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); |
2701 | skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); | 2701 | skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); |
2702 | 2702 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index a48b08681261..ddcbc4d10dab 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -87,8 +87,9 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; | |||
87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) | 87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) |
88 | { | 88 | { |
89 | printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " | 89 | printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " |
90 | "data:%p tail:%p end:%p dev:%s\n", | 90 | "data:%p tail:%#lx end:%p dev:%s\n", |
91 | here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | 91 | here, skb->len, sz, skb->head, skb->data, |
92 | (unsigned long)skb->tail, skb->end, | ||
92 | skb->dev ? skb->dev->name : "<NULL>"); | 93 | skb->dev ? skb->dev->name : "<NULL>"); |
93 | BUG(); | 94 | BUG(); |
94 | } | 95 | } |
@@ -105,8 +106,9 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) | |||
105 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) | 106 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) |
106 | { | 107 | { |
107 | printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " | 108 | printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " |
108 | "data:%p tail:%p end:%p dev:%s\n", | 109 | "data:%p tail:%#lx end:%p dev:%s\n", |
109 | here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | 110 | here, skb->len, sz, skb->head, skb->data, |
111 | (unsigned long)skb->tail, skb->end, | ||
110 | skb->dev ? skb->dev->name : "<NULL>"); | 112 | skb->dev ? skb->dev->name : "<NULL>"); |
111 | BUG(); | 113 | BUG(); |
112 | } | 114 | } |
@@ -167,7 +169,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
167 | atomic_set(&skb->users, 1); | 169 | atomic_set(&skb->users, 1); |
168 | skb->head = data; | 170 | skb->head = data; |
169 | skb->data = data; | 171 | skb->data = data; |
170 | skb->tail = data; | 172 | skb_reset_tail_pointer(skb); |
171 | skb->end = data + size; | 173 | skb->end = data + size; |
172 | /* make sure we initialize shinfo sequentially */ | 174 | /* make sure we initialize shinfo sequentially */ |
173 | shinfo = skb_shinfo(skb); | 175 | shinfo = skb_shinfo(skb); |
@@ -629,7 +631,12 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
629 | 631 | ||
630 | /* Copy only real data... and, alas, header. This should be | 632 | /* Copy only real data... and, alas, header. This should be |
631 | * optimized for the cases when header is void. */ | 633 | * optimized for the cases when header is void. */ |
632 | memcpy(data + nhead, skb->head, skb->tail - skb->head); | 634 | memcpy(data + nhead, skb->head, |
635 | skb->tail | ||
636 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||
637 | - skb->head | ||
638 | #endif | ||
639 | ); | ||
633 | memcpy(data + size, skb->end, sizeof(struct skb_shared_info)); | 640 | memcpy(data + size, skb->end, sizeof(struct skb_shared_info)); |
634 | 641 | ||
635 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 642 | 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, | |||
645 | skb->head = data; | 652 | skb->head = data; |
646 | skb->end = data + size; | 653 | skb->end = data + size; |
647 | skb->data += off; | 654 | skb->data += off; |
648 | skb->tail += off; | ||
649 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | 655 | #ifndef NET_SKBUFF_DATA_USES_OFFSET |
650 | /* {transport,network,mac}_header are relative to skb->head */ | 656 | /* {transport,network,mac}_header and tail are relative to skb->head */ |
657 | skb->tail += off; | ||
651 | skb->transport_header += off; | 658 | skb->transport_header += off; |
652 | skb->network_header += off; | 659 | skb->network_header += off; |
653 | skb->mac_header += off; | 660 | skb->mac_header += off; |
@@ -762,7 +769,7 @@ int skb_pad(struct sk_buff *skb, int pad) | |||
762 | return 0; | 769 | return 0; |
763 | } | 770 | } |
764 | 771 | ||
765 | ntail = skb->data_len + pad - (skb->end - skb->tail); | 772 | ntail = skb->data_len + pad - (skb->end - skb_tail_pointer(skb)); |
766 | if (likely(skb_cloned(skb) || ntail > 0)) { | 773 | if (likely(skb_cloned(skb) || ntail > 0)) { |
767 | err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); | 774 | err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); |
768 | if (unlikely(err)) | 775 | if (unlikely(err)) |
@@ -863,7 +870,7 @@ done: | |||
863 | } else { | 870 | } else { |
864 | skb->len = len; | 871 | skb->len = len; |
865 | skb->data_len = 0; | 872 | skb->data_len = 0; |
866 | skb->tail = skb->data + len; | 873 | skb_set_tail_pointer(skb, len); |
867 | } | 874 | } |
868 | 875 | ||
869 | return 0; | 876 | return 0; |
@@ -900,7 +907,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) | |||
900 | * plus 128 bytes for future expansions. If we have enough | 907 | * plus 128 bytes for future expansions. If we have enough |
901 | * room at tail, reallocate without expansion only if skb is cloned. | 908 | * room at tail, reallocate without expansion only if skb is cloned. |
902 | */ | 909 | */ |
903 | int i, k, eat = (skb->tail + delta) - skb->end; | 910 | int i, k, eat = (skb_tail_pointer(skb) + delta) - skb->end; |
904 | 911 | ||
905 | if (eat > 0 || skb_cloned(skb)) { | 912 | if (eat > 0 || skb_cloned(skb)) { |
906 | if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, | 913 | 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) | |||
908 | return NULL; | 915 | return NULL; |
909 | } | 916 | } |
910 | 917 | ||
911 | if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta)) | 918 | if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta)) |
912 | BUG(); | 919 | BUG(); |
913 | 920 | ||
914 | /* Optimization: no fragments, no reasons to preestimate | 921 | /* Optimization: no fragments, no reasons to preestimate |
@@ -1004,7 +1011,7 @@ pull_pages: | |||
1004 | skb->tail += delta; | 1011 | skb->tail += delta; |
1005 | skb->data_len -= delta; | 1012 | skb->data_len -= delta; |
1006 | 1013 | ||
1007 | return skb->tail; | 1014 | return skb_tail_pointer(skb); |
1008 | } | 1015 | } |
1009 | 1016 | ||
1010 | /* Copy some data bits from skb to kernel buffer. */ | 1017 | /* Copy some data bits from skb to kernel buffer. */ |
@@ -1539,7 +1546,7 @@ static inline void skb_split_inside_header(struct sk_buff *skb, | |||
1539 | skb1->len += skb1->data_len; | 1546 | skb1->len += skb1->data_len; |
1540 | skb->data_len = 0; | 1547 | skb->data_len = 0; |
1541 | skb->len = len; | 1548 | skb->len = len; |
1542 | skb->tail = skb->data + len; | 1549 | skb_set_tail_pointer(skb, len); |
1543 | } | 1550 | } |
1544 | 1551 | ||
1545 | static inline void skb_split_no_header(struct sk_buff *skb, | 1552 | static inline void skb_split_no_header(struct sk_buff *skb, |
diff --git a/net/core/wireless.c b/net/core/wireless.c index 7c6a5db544f1..4a777b68e3bc 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c | |||
@@ -1938,7 +1938,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff * skb, | |||
1938 | { | 1938 | { |
1939 | struct ifinfomsg *r; | 1939 | struct ifinfomsg *r; |
1940 | struct nlmsghdr *nlh; | 1940 | struct nlmsghdr *nlh; |
1941 | unsigned char *b = skb->tail; | 1941 | unsigned char *b = skb_tail_pointer(skb); |
1942 | 1942 | ||
1943 | nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); | 1943 | nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); |
1944 | r = NLMSG_DATA(nlh); | 1944 | r = NLMSG_DATA(nlh); |
@@ -1952,7 +1952,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff * skb, | |||
1952 | /* Add the wireless events in the netlink packet */ | 1952 | /* Add the wireless events in the netlink packet */ |
1953 | RTA_PUT(skb, IFLA_WIRELESS, event_len, event); | 1953 | RTA_PUT(skb, IFLA_WIRELESS, event_len, event); |
1954 | 1954 | ||
1955 | nlh->nlmsg_len = skb->tail - b; | 1955 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1956 | return skb->len; | 1956 | return skb->len; |
1957 | 1957 | ||
1958 | nlmsg_failure: | 1958 | nlmsg_failure: |
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index 84b8c5b45fef..7404653880b0 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c | |||
@@ -681,8 +681,10 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
681 | if (scp->peer.sdn_objnum) | 681 | if (scp->peer.sdn_objnum) |
682 | type = 0; | 682 | type = 0; |
683 | 683 | ||
684 | skb_put(skb, dn_sockaddr2username(&scp->peer, skb->tail, type)); | 684 | skb_put(skb, dn_sockaddr2username(&scp->peer, |
685 | skb_put(skb, dn_sockaddr2username(&scp->addr, skb->tail, 2)); | 685 | skb_tail_pointer(skb), type)); |
686 | skb_put(skb, dn_sockaddr2username(&scp->addr, | ||
687 | skb_tail_pointer(skb), 2)); | ||
686 | 688 | ||
687 | menuver = DN_MENUVER_ACC | DN_MENUVER_USR; | 689 | menuver = DN_MENUVER_ACC | DN_MENUVER_USR; |
688 | if (scp->peer.sdn_flags & SDF_PROXY) | 690 | if (scp->peer.sdn_flags & SDF_PROXY) |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index bb73bf16630f..9678b096b844 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1468,7 +1468,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1468 | struct dn_route *rt = (struct dn_route *)skb->dst; | 1468 | struct dn_route *rt = (struct dn_route *)skb->dst; |
1469 | struct rtmsg *r; | 1469 | struct rtmsg *r; |
1470 | struct nlmsghdr *nlh; | 1470 | struct nlmsghdr *nlh; |
1471 | unsigned char *b = skb->tail; | 1471 | unsigned char *b = skb_tail_pointer(skb); |
1472 | long expires; | 1472 | long expires; |
1473 | 1473 | ||
1474 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | 1474 | 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, | |||
1509 | if (rt->fl.iif) | 1509 | if (rt->fl.iif) |
1510 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); | 1510 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); |
1511 | 1511 | ||
1512 | nlh->nlmsg_len = skb->tail - b; | 1512 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1513 | return skb->len; | 1513 | return skb->len; |
1514 | 1514 | ||
1515 | nlmsg_failure: | 1515 | nlmsg_failure: |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 780a141f8342..544c45540746 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -295,7 +295,7 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
295 | { | 295 | { |
296 | struct rtmsg *rtm; | 296 | struct rtmsg *rtm; |
297 | struct nlmsghdr *nlh; | 297 | struct nlmsghdr *nlh; |
298 | unsigned char *b = skb->tail; | 298 | unsigned char *b = skb_tail_pointer(skb); |
299 | 299 | ||
300 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); | 300 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); |
301 | rtm = NLMSG_DATA(nlh); | 301 | rtm = NLMSG_DATA(nlh); |
@@ -337,13 +337,13 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
337 | nhp->rtnh_ifindex = nh->nh_oif; | 337 | nhp->rtnh_ifindex = nh->nh_oif; |
338 | if (nh->nh_gw) | 338 | if (nh->nh_gw) |
339 | RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); | 339 | RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); |
340 | nhp->rtnh_len = skb->tail - (unsigned char *)nhp; | 340 | nhp->rtnh_len = skb_tail_pointer(skb) - (unsigned char *)nhp; |
341 | } endfor_nexthops(fi); | 341 | } endfor_nexthops(fi); |
342 | mp_head->rta_type = RTA_MULTIPATH; | 342 | mp_head->rta_type = RTA_MULTIPATH; |
343 | mp_head->rta_len = skb->tail - (u8*)mp_head; | 343 | mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head; |
344 | } | 344 | } |
345 | 345 | ||
346 | nlh->nlmsg_len = skb->tail - b; | 346 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
347 | return skb->len; | 347 | return skb->len; |
348 | 348 | ||
349 | 349 | ||
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 0e62def05a58..ceefd9dd0c92 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -33,7 +33,7 @@ static struct sk_buff *dnrmg_build_message(struct sk_buff *rt_skb, int *errp) | |||
33 | { | 33 | { |
34 | struct sk_buff *skb = NULL; | 34 | struct sk_buff *skb = NULL; |
35 | size_t size; | 35 | size_t size; |
36 | unsigned char *old_tail; | 36 | sk_buff_data_t old_tail; |
37 | struct nlmsghdr *nlh; | 37 | struct nlmsghdr *nlh; |
38 | unsigned char *ptr; | 38 | unsigned char *ptr; |
39 | struct nf_dn_rtmsg *rtm; | 39 | struct nf_dn_rtmsg *rtm; |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 78993dadb53a..b5524f32ac2d 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -366,7 +366,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
366 | fh->cb = cb; | 366 | fh->cb = cb; |
367 | fh->port = port; | 367 | fh->port = port; |
368 | if (sock->type != SOCK_DGRAM) { | 368 | if (sock->type != SOCK_DGRAM) { |
369 | skb->tail = skb->data; | 369 | skb_reset_tail_pointer(skb); |
370 | skb->len = 0; | 370 | skb->len = 0; |
371 | } else if (res < 0) | 371 | } else if (res < 0) |
372 | goto out_free; | 372 | goto out_free; |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 59a765c49cf9..2b854941e06c 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -595,7 +595,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
595 | if (frag != 0) | 595 | if (frag != 0) |
596 | flen -= hdrlen; | 596 | flen -= hdrlen; |
597 | 597 | ||
598 | if (frag_skb->tail + flen > frag_skb->end) { | 598 | if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { |
599 | printk(KERN_WARNING "%s: host decrypted and " | 599 | printk(KERN_WARNING "%s: host decrypted and " |
600 | "reassembled frame did not fit skb\n", | 600 | "reassembled frame did not fit skb\n", |
601 | dev->name); | 601 | dev->name); |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index de019f9fbfe1..5e5613930ffb 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -21,6 +21,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
21 | struct blkcipher_desc desc; | 21 | struct blkcipher_desc desc; |
22 | struct esp_data *esp; | 22 | struct esp_data *esp; |
23 | struct sk_buff *trailer; | 23 | struct sk_buff *trailer; |
24 | u8 *tail; | ||
24 | int blksize; | 25 | int blksize; |
25 | int clen; | 26 | int clen; |
26 | int alen; | 27 | int alen; |
@@ -49,12 +50,13 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
49 | goto error; | 50 | goto error; |
50 | 51 | ||
51 | /* Fill padding... */ | 52 | /* Fill padding... */ |
53 | tail = skb_tail_pointer(trailer); | ||
52 | do { | 54 | do { |
53 | int i; | 55 | int i; |
54 | for (i=0; i<clen-skb->len - 2; i++) | 56 | for (i=0; i<clen-skb->len - 2; i++) |
55 | *(u8*)(trailer->tail + i) = i+1; | 57 | tail[i] = i + 1; |
56 | } while (0); | 58 | } while (0); |
57 | *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; | 59 | tail[clen - skb->len - 2] = (clen - skb->len) - 2; |
58 | pskb_put(skb, trailer, clen - skb->len); | 60 | pskb_put(skb, trailer, clen - skb->len); |
59 | 61 | ||
60 | __skb_push(skb, skb->data - skb_network_header(skb)); | 62 | __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) | |||
62 | esph = (struct ip_esp_hdr *)(skb_network_header(skb) + | 64 | esph = (struct ip_esp_hdr *)(skb_network_header(skb) + |
63 | top_iph->ihl * 4); | 65 | top_iph->ihl * 4); |
64 | top_iph->tot_len = htons(skb->len + alen); | 66 | top_iph->tot_len = htons(skb->len + alen); |
65 | *(u8*)(trailer->tail - 1) = top_iph->protocol; | 67 | *(skb_tail_pointer(skb) - 1) = top_iph->protocol; |
66 | 68 | ||
67 | /* this is non-NULL only with UDP Encapsulation */ | 69 | /* this is non-NULL only with UDP Encapsulation */ |
68 | if (x->encap) { | 70 | if (x->encap) { |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 8372f8b8f0cd..d38cbba92a4d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -450,7 +450,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
450 | */ | 450 | */ |
451 | iph = ip_hdr(skb_in); | 451 | iph = ip_hdr(skb_in); |
452 | 452 | ||
453 | if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail) | 453 | if ((u8 *)iph < skb_in->head || |
454 | (skb_in->network_header + sizeof(*iph)) > skb_in->tail) | ||
454 | goto out; | 455 | goto out; |
455 | 456 | ||
456 | /* | 457 | /* |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 1fc637fb6750..2506021c2935 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -348,8 +348,8 @@ static int igmpv3_sendpack(struct sk_buff *skb) | |||
348 | { | 348 | { |
349 | struct iphdr *pip = ip_hdr(skb); | 349 | struct iphdr *pip = ip_hdr(skb); |
350 | struct igmphdr *pig = igmp_hdr(skb); | 350 | struct igmphdr *pig = igmp_hdr(skb); |
351 | const int iplen = skb->tail - skb_network_header(skb); | 351 | const int iplen = skb->tail - skb->network_header; |
352 | const int igmplen = skb->tail - skb_transport_header(skb); | 352 | const int igmplen = skb->tail - skb->transport_header; |
353 | 353 | ||
354 | pip->tot_len = htons(iplen); | 354 | pip->tot_len = htons(iplen); |
355 | ip_send_check(pip); | 355 | ip_send_check(pip); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 5df71cd08da8..37362cd1d07f 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
60 | struct nlmsghdr *nlh; | 60 | struct nlmsghdr *nlh; |
61 | void *info = NULL; | 61 | void *info = NULL; |
62 | struct inet_diag_meminfo *minfo = NULL; | 62 | struct inet_diag_meminfo *minfo = NULL; |
63 | unsigned char *b = skb->tail; | 63 | unsigned char *b = skb_tail_pointer(skb); |
64 | const struct inet_diag_handler *handler; | 64 | const struct inet_diag_handler *handler; |
65 | 65 | ||
66 | handler = inet_diag_table[unlh->nlmsg_type]; | 66 | handler = inet_diag_table[unlh->nlmsg_type]; |
@@ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
147 | icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) | 147 | icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) |
148 | icsk->icsk_ca_ops->get_info(sk, ext, skb); | 148 | icsk->icsk_ca_ops->get_info(sk, ext, skb); |
149 | 149 | ||
150 | nlh->nlmsg_len = skb->tail - b; | 150 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
151 | return skb->len; | 151 | return skb->len; |
152 | 152 | ||
153 | rtattr_failure: | 153 | rtattr_failure: |
@@ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | |||
163 | { | 163 | { |
164 | long tmo; | 164 | long tmo; |
165 | struct inet_diag_msg *r; | 165 | struct inet_diag_msg *r; |
166 | const unsigned char *previous_tail = skb->tail; | 166 | const unsigned char *previous_tail = skb_tail_pointer(skb); |
167 | struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, | 167 | struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, |
168 | unlh->nlmsg_type, sizeof(*r)); | 168 | unlh->nlmsg_type, sizeof(*r)); |
169 | 169 | ||
@@ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | |||
205 | &tw6->tw_v6_daddr); | 205 | &tw6->tw_v6_daddr); |
206 | } | 206 | } |
207 | #endif | 207 | #endif |
208 | nlh->nlmsg_len = skb->tail - previous_tail; | 208 | nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail; |
209 | return skb->len; | 209 | return skb->len; |
210 | nlmsg_failure: | 210 | nlmsg_failure: |
211 | skb_trim(skb, previous_tail - skb->data); | 211 | skb_trim(skb, previous_tail - skb->data); |
@@ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
535 | { | 535 | { |
536 | const struct inet_request_sock *ireq = inet_rsk(req); | 536 | const struct inet_request_sock *ireq = inet_rsk(req); |
537 | struct inet_sock *inet = inet_sk(sk); | 537 | struct inet_sock *inet = inet_sk(sk); |
538 | unsigned char *b = skb->tail; | 538 | unsigned char *b = skb_tail_pointer(skb); |
539 | struct inet_diag_msg *r; | 539 | struct inet_diag_msg *r; |
540 | struct nlmsghdr *nlh; | 540 | struct nlmsghdr *nlh; |
541 | long tmo; | 541 | long tmo; |
@@ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
574 | &inet6_rsk(req)->rmt_addr); | 574 | &inet6_rsk(req)->rmt_addr); |
575 | } | 575 | } |
576 | #endif | 576 | #endif |
577 | nlh->nlmsg_len = skb->tail - b; | 577 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
578 | 578 | ||
579 | return skb->len; | 579 | return skb->len; |
580 | 580 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index fcb35cd5ccfd..c199d2311731 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -316,7 +316,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf | |||
316 | serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | 316 | serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); |
317 | serr->port = port; | 317 | serr->port = port; |
318 | 318 | ||
319 | __skb_pull(skb, skb->tail - skb->data); | 319 | __skb_pull(skb, skb_tail_pointer(skb) - skb->data); |
320 | skb_reset_transport_header(skb); | 320 | skb_reset_transport_header(skb); |
321 | 321 | ||
322 | if (sock_queue_err_skb(sk, skb)) | 322 | if (sock_queue_err_skb(sk, skb)) |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 50d0b301380e..ea0a491dce92 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -513,7 +513,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) | |||
513 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 513 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); |
514 | 514 | ||
515 | if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { | 515 | if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { |
516 | nlh->nlmsg_len = skb->tail - (u8*)nlh; | 516 | nlh->nlmsg_len = (skb_tail_pointer(skb) - |
517 | (u8 *)nlh); | ||
517 | } else { | 518 | } else { |
518 | nlh->nlmsg_type = NLMSG_ERROR; | 519 | nlh->nlmsg_type = NLMSG_ERROR; |
519 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 520 | 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) | |||
580 | * Copy the IP header | 581 | * Copy the IP header |
581 | */ | 582 | */ |
582 | 583 | ||
583 | skb_set_network_header(skb, skb->tail - skb->data); | 584 | skb->network_header = skb->tail; |
584 | skb_put(skb, ihl); | 585 | skb_put(skb, ihl); |
585 | memcpy(skb->data,pkt->data,ihl); | 586 | memcpy(skb->data,pkt->data,ihl); |
586 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ | 587 | 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) | |||
1544 | int ct; | 1545 | int ct; |
1545 | struct rtnexthop *nhp; | 1546 | struct rtnexthop *nhp; |
1546 | struct net_device *dev = vif_table[c->mfc_parent].dev; | 1547 | struct net_device *dev = vif_table[c->mfc_parent].dev; |
1547 | u8 *b = skb->tail; | 1548 | u8 *b = skb_tail_pointer(skb); |
1548 | struct rtattr *mp_head; | 1549 | struct rtattr *mp_head; |
1549 | 1550 | ||
1550 | if (dev) | 1551 | if (dev) |
@@ -1564,7 +1565,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) | |||
1564 | } | 1565 | } |
1565 | } | 1566 | } |
1566 | mp_head->rta_type = RTA_MULTIPATH; | 1567 | mp_head->rta_type = RTA_MULTIPATH; |
1567 | mp_head->rta_len = skb->tail - (u8*)mp_head; | 1568 | mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head; |
1568 | rtm->rtm_type = RTN_MULTICAST; | 1569 | rtm->rtm_type = RTN_MULTICAST; |
1569 | return 1; | 1570 | return 1; |
1570 | 1571 | ||
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index 25bd68967305..344ddbbdc756 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c | |||
@@ -162,7 +162,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
162 | iph = ip_hdr(*pskb); | 162 | iph = ip_hdr(*pskb); |
163 | th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); | 163 | th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); |
164 | data = (char *)th + (th->doff << 2); | 164 | data = (char *)th + (th->doff << 2); |
165 | data_limit = (*pskb)->tail; | 165 | data_limit = skb_tail_pointer(*pskb); |
166 | 166 | ||
167 | if (ip_vs_ftp_get_addrport(data, data_limit, | 167 | if (ip_vs_ftp_get_addrport(data, data_limit, |
168 | SERVER_STRING, | 168 | SERVER_STRING, |
@@ -269,7 +269,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
269 | the length of the header in 32-bit multiples, it is accurate | 269 | the length of the header in 32-bit multiples, it is accurate |
270 | to calculate data address by th+HLEN*4 */ | 270 | to calculate data address by th+HLEN*4 */ |
271 | data = data_start = (char *)th + (th->doff << 2); | 271 | data = data_start = (char *)th + (th->doff << 2); |
272 | data_limit = (*pskb)->tail; | 272 | data_limit = skb_tail_pointer(*pskb); |
273 | 273 | ||
274 | while (data <= data_limit - 6) { | 274 | while (data <= data_limit - 6) { |
275 | if (strnicmp(data, "PASV\r\n", 6) == 0) { | 275 | if (strnicmp(data, "PASV\r\n", 6) == 0) { |
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c index b4450f1ccc1b..6298d404e7c7 100644 --- a/net/ipv4/netfilter/arpt_mangle.c +++ b/net/ipv4/netfilter/arpt_mangle.c | |||
@@ -37,28 +37,28 @@ target(struct sk_buff **pskb, | |||
37 | /* We assume that pln and hln were checked in the match */ | 37 | /* We assume that pln and hln were checked in the match */ |
38 | if (mangle->flags & ARPT_MANGLE_SDEV) { | 38 | if (mangle->flags & ARPT_MANGLE_SDEV) { |
39 | if (ARPT_DEV_ADDR_LEN_MAX < hln || | 39 | if (ARPT_DEV_ADDR_LEN_MAX < hln || |
40 | (arpptr + hln > (**pskb).tail)) | 40 | (arpptr + hln > skb_tail_pointer(*pskb))) |
41 | return NF_DROP; | 41 | return NF_DROP; |
42 | memcpy(arpptr, mangle->src_devaddr, hln); | 42 | memcpy(arpptr, mangle->src_devaddr, hln); |
43 | } | 43 | } |
44 | arpptr += hln; | 44 | arpptr += hln; |
45 | if (mangle->flags & ARPT_MANGLE_SIP) { | 45 | if (mangle->flags & ARPT_MANGLE_SIP) { |
46 | if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | 46 | if (ARPT_MANGLE_ADDR_LEN_MAX < pln || |
47 | (arpptr + pln > (**pskb).tail)) | 47 | (arpptr + pln > skb_tail_pointer(*pskb))) |
48 | return NF_DROP; | 48 | return NF_DROP; |
49 | memcpy(arpptr, &mangle->u_s.src_ip, pln); | 49 | memcpy(arpptr, &mangle->u_s.src_ip, pln); |
50 | } | 50 | } |
51 | arpptr += pln; | 51 | arpptr += pln; |
52 | if (mangle->flags & ARPT_MANGLE_TDEV) { | 52 | if (mangle->flags & ARPT_MANGLE_TDEV) { |
53 | if (ARPT_DEV_ADDR_LEN_MAX < hln || | 53 | if (ARPT_DEV_ADDR_LEN_MAX < hln || |
54 | (arpptr + hln > (**pskb).tail)) | 54 | (arpptr + hln > skb_tail_pointer(*pskb))) |
55 | return NF_DROP; | 55 | return NF_DROP; |
56 | memcpy(arpptr, mangle->tgt_devaddr, hln); | 56 | memcpy(arpptr, mangle->tgt_devaddr, hln); |
57 | } | 57 | } |
58 | arpptr += hln; | 58 | arpptr += hln; |
59 | if (mangle->flags & ARPT_MANGLE_TIP) { | 59 | if (mangle->flags & ARPT_MANGLE_TIP) { |
60 | if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | 60 | if (ARPT_MANGLE_ADDR_LEN_MAX < pln || |
61 | (arpptr + pln > (**pskb).tail)) | 61 | (arpptr + pln > skb_tail_pointer(*pskb))) |
62 | return NF_DROP; | 62 | return NF_DROP; |
63 | memcpy(arpptr, &mangle->u_t.tgt_ip, pln); | 63 | memcpy(arpptr, &mangle->u_t.tgt_ip, pln); |
64 | } | 64 | } |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 5842f1aa973a..15e0d2002235 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -191,7 +191,7 @@ ipq_flush(int verdict) | |||
191 | static struct sk_buff * | 191 | static struct sk_buff * |
192 | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | 192 | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) |
193 | { | 193 | { |
194 | unsigned char *old_tail; | 194 | sk_buff_data_t old_tail; |
195 | size_t size = 0; | 195 | size_t size = 0; |
196 | size_t data_len = 0; | 196 | size_t data_len = 0; |
197 | struct sk_buff *skb; | 197 | struct sk_buff *skb; |
@@ -235,7 +235,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | |||
235 | if (!skb) | 235 | if (!skb) |
236 | goto nlmsg_failure; | 236 | goto nlmsg_failure; |
237 | 237 | ||
238 | old_tail= skb->tail; | 238 | old_tail = skb->tail; |
239 | nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | 239 | nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); |
240 | pmsg = NLMSG_DATA(nlh); | 240 | pmsg = NLMSG_DATA(nlh); |
241 | memset(pmsg, 0, sizeof(*pmsg)); | 241 | memset(pmsg, 0, sizeof(*pmsg)); |
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index c2c92ff12781..8a40fbe842b7 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c | |||
@@ -92,7 +92,8 @@ static void mangle_contents(struct sk_buff *skb, | |||
92 | /* move post-replacement */ | 92 | /* move post-replacement */ |
93 | memmove(data + match_offset + rep_len, | 93 | memmove(data + match_offset + rep_len, |
94 | data + match_offset + match_len, | 94 | data + match_offset + match_len, |
95 | skb->tail - (data + match_offset + match_len)); | 95 | skb->tail - (skb->network_header + dataoff + |
96 | match_offset + match_len)); | ||
96 | 97 | ||
97 | /* insert data from buffer */ | 98 | /* insert data from buffer */ |
98 | memcpy(data + match_offset, rep_buffer, rep_len); | 99 | memcpy(data + match_offset, rep_buffer, rep_len); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 2b214cc3724c..18a09a78ca0b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2231,7 +2231,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2231 | th->cwr = 0; | 2231 | th->cwr = 0; |
2232 | } while (skb->next); | 2232 | } while (skb->next); |
2233 | 2233 | ||
2234 | delta = htonl(oldlen + (skb->tail - skb_transport_header(skb)) + | 2234 | delta = htonl(oldlen + (skb->tail - skb->transport_header) + |
2235 | skb->data_len); | 2235 | skb->data_len); |
2236 | th->check = ~csum_fold((__force __wsum)((__force u32)th->check + | 2236 | th->check = ~csum_fold((__force __wsum)((__force u32)th->check + |
2237 | (__force u32)delta)); | 2237 | (__force u32)delta)); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 29c53fbb2204..c22cdcd84320 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -733,7 +733,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | |||
733 | } | 733 | } |
734 | skb_shinfo(skb)->nr_frags = k; | 734 | skb_shinfo(skb)->nr_frags = k; |
735 | 735 | ||
736 | skb->tail = skb->data; | 736 | skb_reset_tail_pointer(skb); |
737 | skb->data_len -= len; | 737 | skb->data_len -= len; |
738 | skb->len = skb->data_len; | 738 | skb->len = skb->data_len; |
739 | } | 739 | } |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index f16f4f0c5814..4a355fea4098 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -268,7 +268,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info) | |||
268 | serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | 268 | serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); |
269 | serr->port = fl->fl_ip_dport; | 269 | serr->port = fl->fl_ip_dport; |
270 | 270 | ||
271 | __skb_pull(skb, skb->tail - skb->data); | 271 | __skb_pull(skb, skb_tail_pointer(skb) - skb->data); |
272 | skb_reset_transport_header(skb); | 272 | skb_reset_transport_header(skb); |
273 | 273 | ||
274 | if (sock_queue_err_skb(sk, skb)) | 274 | if (sock_queue_err_skb(sk, skb)) |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 7fdf84dee73f..b8e8914cc002 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -51,6 +51,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
51 | int clen; | 51 | int clen; |
52 | int alen; | 52 | int alen; |
53 | int nfrags; | 53 | int nfrags; |
54 | u8 *tail; | ||
54 | struct esp_data *esp = x->data; | 55 | struct esp_data *esp = x->data; |
55 | int hdr_len = (skb_transport_offset(skb) + | 56 | int hdr_len = (skb_transport_offset(skb) + |
56 | sizeof(*esph) + esp->conf.ivlen); | 57 | sizeof(*esph) + esp->conf.ivlen); |
@@ -78,18 +79,19 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
78 | } | 79 | } |
79 | 80 | ||
80 | /* Fill padding... */ | 81 | /* Fill padding... */ |
82 | tail = skb_tail_pointer(trailer); | ||
81 | do { | 83 | do { |
82 | int i; | 84 | int i; |
83 | for (i=0; i<clen-skb->len - 2; i++) | 85 | for (i=0; i<clen-skb->len - 2; i++) |
84 | *(u8*)(trailer->tail + i) = i+1; | 86 | tail[i] = i + 1; |
85 | } while (0); | 87 | } while (0); |
86 | *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; | 88 | tail[clen-skb->len - 2] = (clen - skb->len) - 2; |
87 | pskb_put(skb, trailer, clen - skb->len); | 89 | pskb_put(skb, trailer, clen - skb->len); |
88 | 90 | ||
89 | top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len); | 91 | top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len); |
90 | esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); | 92 | esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); |
91 | top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); | 93 | top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); |
92 | *(u8 *)(trailer->tail - 1) = *skb_network_header(skb); | 94 | *(skb_tail_pointer(skb) - 1) = *skb_network_header(skb); |
93 | *skb_network_header(skb) = IPPROTO_ESP; | 95 | *skb_network_header(skb) = IPPROTO_ESP; |
94 | 96 | ||
95 | esph->spi = x->id.spi; | 97 | esph->spi = x->id.spi; |
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index a6a275db88cd..275d2e812a44 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -51,7 +51,7 @@ | |||
51 | int ipv6_find_tlv(struct sk_buff *skb, int offset, int type) | 51 | int ipv6_find_tlv(struct sk_buff *skb, int offset, int type) |
52 | { | 52 | { |
53 | const unsigned char *nh = skb_network_header(skb); | 53 | const unsigned char *nh = skb_network_header(skb); |
54 | int packet_len = skb->tail - nh; | 54 | int packet_len = skb->tail - skb->network_header; |
55 | struct ipv6_opt_hdr *hdr; | 55 | struct ipv6_opt_hdr *hdr; |
56 | int len; | 56 | int len; |
57 | 57 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index d3edc3cf1ce9..e94992ab92e6 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -317,7 +317,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
317 | int hlimit, tclass; | 317 | int hlimit, tclass; |
318 | int err = 0; | 318 | int err = 0; |
319 | 319 | ||
320 | if ((u8*)hdr < skb->head || (u8*)(hdr+1) > skb->tail) | 320 | if ((u8 *)hdr < skb->head || |
321 | (skb->network_header + sizeof(*hdr)) > skb->tail) | ||
321 | return; | 322 | return; |
322 | 323 | ||
323 | /* | 324 | /* |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index b2c092c6b9dc..e2b8db6b9aef 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -514,7 +514,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | |||
514 | u16 offset = sizeof(struct ipv6hdr); | 514 | u16 offset = sizeof(struct ipv6hdr); |
515 | struct ipv6_opt_hdr *exthdr = | 515 | struct ipv6_opt_hdr *exthdr = |
516 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 516 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); |
517 | unsigned int packet_len = skb->tail - skb_network_header(skb); | 517 | unsigned int packet_len = skb->tail - skb->network_header; |
518 | int found_rhdr = 0; | 518 | int found_rhdr = 0; |
519 | *nexthdr = &ipv6_hdr(skb)->nexthdr; | 519 | *nexthdr = &ipv6_hdr(skb)->nexthdr; |
520 | 520 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 4c45bcce75e8..6c2758951d60 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1423,7 +1423,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) | |||
1423 | 1423 | ||
1424 | memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); | 1424 | memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); |
1425 | 1425 | ||
1426 | skb_set_transport_header(skb, skb->tail - skb->data); | 1426 | skb_set_transport_header(skb, skb_tail_pointer(skb) - skb->data); |
1427 | skb_put(skb, sizeof(*pmr)); | 1427 | skb_put(skb, sizeof(*pmr)); |
1428 | pmr = (struct mld2_report *)skb_transport_header(skb); | 1428 | pmr = (struct mld2_report *)skb_transport_header(skb); |
1429 | pmr->type = ICMPV6_MLD2_REPORT; | 1429 | pmr->type = ICMPV6_MLD2_REPORT; |
@@ -1468,8 +1468,8 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1468 | int err; | 1468 | int err; |
1469 | 1469 | ||
1470 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | 1470 | IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); |
1471 | payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6); | 1471 | payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); |
1472 | mldlen = skb->tail - skb_transport_header(skb); | 1472 | mldlen = skb->tail - skb->transport_header; |
1473 | pip6->payload_len = htons(payload_len); | 1473 | pip6->payload_len = htons(payload_len); |
1474 | 1474 | ||
1475 | pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, | 1475 | pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index f0288e92fb52..6ed763ee6785 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -260,7 +260,7 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb, | |||
260 | struct ipv6_opt_hdr *exthdr = | 260 | struct ipv6_opt_hdr *exthdr = |
261 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 261 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); |
262 | const unsigned char *nh = skb_network_header(skb); | 262 | const unsigned char *nh = skb_network_header(skb); |
263 | unsigned int packet_len = skb->tail - nh; | 263 | unsigned int packet_len = skb->tail - skb->network_header; |
264 | int found_rhdr = 0; | 264 | int found_rhdr = 0; |
265 | 265 | ||
266 | *nexthdr = &ipv6_hdr(skb)->nexthdr; | 266 | *nexthdr = &ipv6_hdr(skb)->nexthdr; |
@@ -392,7 +392,7 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb, | |||
392 | struct ipv6_opt_hdr *exthdr = | 392 | struct ipv6_opt_hdr *exthdr = |
393 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 393 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); |
394 | const unsigned char *nh = skb_network_header(skb); | 394 | const unsigned char *nh = skb_network_header(skb); |
395 | unsigned int packet_len = skb->tail - nh; | 395 | unsigned int packet_len = skb->tail - skb->network_header; |
396 | int found_rhdr = 0; | 396 | int found_rhdr = 0; |
397 | 397 | ||
398 | *nexthdr = &ipv6_hdr(skb)->nexthdr; | 398 | *nexthdr = &ipv6_hdr(skb)->nexthdr; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index f8e619772fb4..b1cf70816477 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -492,7 +492,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
492 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 492 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
493 | ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); | 493 | ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); |
494 | 494 | ||
495 | skb_set_transport_header(skb, skb->tail - skb->data); | 495 | skb->transport_header = skb->tail; |
496 | skb_put(skb, len); | 496 | skb_put(skb, len); |
497 | msg = (struct nd_msg *)skb_transport_header(skb); | 497 | msg = (struct nd_msg *)skb_transport_header(skb); |
498 | 498 | ||
@@ -584,7 +584,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, | |||
584 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 584 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
585 | ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | 585 | ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); |
586 | 586 | ||
587 | skb_set_transport_header(skb, skb->tail - skb->data); | 587 | skb->transport_header = skb->tail; |
588 | skb_put(skb, len); | 588 | skb_put(skb, len); |
589 | msg = (struct nd_msg *)skb_transport_header(skb); | 589 | msg = (struct nd_msg *)skb_transport_header(skb); |
590 | msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; | 590 | msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; |
@@ -685,7 +685,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, | |||
685 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 685 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
686 | ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | 686 | ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); |
687 | 687 | ||
688 | skb_set_transport_header(skb, skb->tail - skb->data); | 688 | skb->transport_header = skb->tail; |
689 | skb_put(skb, len); | 689 | skb_put(skb, len); |
690 | hdr = icmp6_hdr(skb); | 690 | hdr = icmp6_hdr(skb); |
691 | hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; | 691 | hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; |
@@ -767,7 +767,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
767 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 767 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
768 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 768 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
769 | u8 *lladdr = NULL; | 769 | u8 *lladdr = NULL; |
770 | u32 ndoptlen = skb->tail - msg->opt; | 770 | u32 ndoptlen = skb->tail - (skb->transport_header + |
771 | offsetof(struct nd_msg, opt)); | ||
771 | struct ndisc_options ndopts; | 772 | struct ndisc_options ndopts; |
772 | struct net_device *dev = skb->dev; | 773 | struct net_device *dev = skb->dev; |
773 | struct inet6_ifaddr *ifp; | 774 | struct inet6_ifaddr *ifp; |
@@ -945,7 +946,8 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
945 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 946 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
946 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 947 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
947 | u8 *lladdr = NULL; | 948 | u8 *lladdr = NULL; |
948 | u32 ndoptlen = skb->tail - msg->opt; | 949 | u32 ndoptlen = skb->tail - (skb->transport_header + |
950 | offsetof(struct nd_msg, opt)); | ||
949 | struct ndisc_options ndopts; | 951 | struct ndisc_options ndopts; |
950 | struct net_device *dev = skb->dev; | 952 | struct net_device *dev = skb->dev; |
951 | struct inet6_ifaddr *ifp; | 953 | struct inet6_ifaddr *ifp; |
@@ -1111,8 +1113,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1111 | 1113 | ||
1112 | __u8 * opt = (__u8 *)(ra_msg + 1); | 1114 | __u8 * opt = (__u8 *)(ra_msg + 1); |
1113 | 1115 | ||
1114 | optlen = (skb->tail - skb_transport_header(skb)) - | 1116 | optlen = (skb->tail - skb->transport_header) - sizeof(struct ra_msg); |
1115 | sizeof(struct ra_msg); | ||
1116 | 1117 | ||
1117 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | 1118 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { |
1118 | ND_PRINTK2(KERN_WARNING | 1119 | ND_PRINTK2(KERN_WARNING |
@@ -1361,7 +1362,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1361 | return; | 1362 | return; |
1362 | } | 1363 | } |
1363 | 1364 | ||
1364 | optlen = skb->tail - skb_transport_header(skb); | 1365 | optlen = skb->tail - skb->transport_header; |
1365 | optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 1366 | optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); |
1366 | 1367 | ||
1367 | if (optlen < 0) { | 1368 | if (optlen < 0) { |
@@ -1522,7 +1523,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1522 | ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, | 1523 | ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, |
1523 | IPPROTO_ICMPV6, len); | 1524 | IPPROTO_ICMPV6, len); |
1524 | 1525 | ||
1525 | skb_set_transport_header(buff, buff->tail - buff->data); | 1526 | skb_set_transport_header(buff, skb_tail_pointer(buff) - buff->data); |
1526 | skb_put(buff, len); | 1527 | skb_put(buff, len); |
1527 | icmph = icmp6_hdr(buff); | 1528 | icmph = icmp6_hdr(buff); |
1528 | 1529 | ||
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 66a2c4135251..5cfce218c5e1 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -189,7 +189,7 @@ ipq_flush(int verdict) | |||
189 | static struct sk_buff * | 189 | static struct sk_buff * |
190 | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | 190 | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) |
191 | { | 191 | { |
192 | unsigned char *old_tail; | 192 | sk_buff_data_t old_tail; |
193 | size_t size = 0; | 193 | size_t size = 0; |
194 | size_t data_len = 0; | 194 | size_t data_len = 0; |
195 | struct sk_buff *skb; | 195 | struct sk_buff *skb; |
@@ -233,7 +233,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | |||
233 | if (!skb) | 233 | if (!skb) |
234 | goto nlmsg_failure; | 234 | goto nlmsg_failure; |
235 | 235 | ||
236 | old_tail= skb->tail; | 236 | old_tail = skb->tail; |
237 | nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | 237 | nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); |
238 | pmsg = NLMSG_DATA(nlh); | 238 | pmsg = NLMSG_DATA(nlh); |
239 | memset(pmsg, 0, sizeof(*pmsg)); | 239 | memset(pmsg, 0, sizeof(*pmsg)); |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 8705f6a502d9..2b3be68b70a7 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1077,7 +1077,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
1077 | spin_lock_bh(&sk->sk_receive_queue.lock); | 1077 | spin_lock_bh(&sk->sk_receive_queue.lock); |
1078 | skb = skb_peek(&sk->sk_receive_queue); | 1078 | skb = skb_peek(&sk->sk_receive_queue); |
1079 | if (skb != NULL) | 1079 | if (skb != NULL) |
1080 | amount = skb->tail - skb_transport_header(skb); | 1080 | amount = skb->tail - skb->transport_header; |
1081 | spin_unlock_bh(&sk->sk_receive_queue.lock); | 1081 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
1082 | return put_user(amount, (int __user *)arg); | 1082 | return put_user(amount, (int __user *)arg); |
1083 | } | 1083 | } |
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c index 01d7c9c7b3b4..e5e4792a0314 100644 --- a/net/irda/ircomm/ircomm_param.c +++ b/net/irda/ircomm/ircomm_param.c | |||
@@ -133,8 +133,8 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) | |||
133 | * Inserting is a little bit tricky since we don't know how much | 133 | * Inserting is a little bit tricky since we don't know how much |
134 | * room we will need. But this should hopefully work OK | 134 | * room we will need. But this should hopefully work OK |
135 | */ | 135 | */ |
136 | count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), | 136 | count = irda_param_insert(self, pi, skb_tail_pointer(skb), |
137 | &ircomm_param_info); | 137 | skb_tailroom(skb), &ircomm_param_info); |
138 | if (count < 0) { | 138 | if (count < 0) { |
139 | IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); | 139 | IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); |
140 | spin_unlock_irqrestore(&self->spinlock, flags); | 140 | spin_unlock_irqrestore(&self->spinlock, flags); |
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index fcf9d6599628..ed69773b0f8e 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -1039,7 +1039,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | /* Insert at end of sk-buffer */ | 1041 | /* Insert at end of sk-buffer */ |
1042 | frame = skb->tail; | 1042 | frame = skb_tail_pointer(skb); |
1043 | 1043 | ||
1044 | /* Make space for data */ | 1044 | /* Make space for data */ |
1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { | 1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { |
diff --git a/net/irda/qos.c b/net/irda/qos.c index 349012c926b7..aeb18cf1dcae 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c | |||
@@ -469,49 +469,49 @@ int irlap_insert_qos_negotiation_params(struct irlap_cb *self, | |||
469 | int ret; | 469 | int ret; |
470 | 470 | ||
471 | /* Insert data rate */ | 471 | /* Insert data rate */ |
472 | ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, | 472 | ret = irda_param_insert(self, PI_BAUD_RATE, skb_tail_pointer(skb), |
473 | skb_tailroom(skb), &irlap_param_info); | 473 | skb_tailroom(skb), &irlap_param_info); |
474 | if (ret < 0) | 474 | if (ret < 0) |
475 | return ret; | 475 | return ret; |
476 | skb_put(skb, ret); | 476 | skb_put(skb, ret); |
477 | 477 | ||
478 | /* Insert max turnaround time */ | 478 | /* Insert max turnaround time */ |
479 | ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, | 479 | ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb_tail_pointer(skb), |
480 | skb_tailroom(skb), &irlap_param_info); | 480 | skb_tailroom(skb), &irlap_param_info); |
481 | if (ret < 0) | 481 | if (ret < 0) |
482 | return ret; | 482 | return ret; |
483 | skb_put(skb, ret); | 483 | skb_put(skb, ret); |
484 | 484 | ||
485 | /* Insert data size */ | 485 | /* Insert data size */ |
486 | ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, | 486 | ret = irda_param_insert(self, PI_DATA_SIZE, skb_tail_pointer(skb), |
487 | skb_tailroom(skb), &irlap_param_info); | 487 | skb_tailroom(skb), &irlap_param_info); |
488 | if (ret < 0) | 488 | if (ret < 0) |
489 | return ret; | 489 | return ret; |
490 | skb_put(skb, ret); | 490 | skb_put(skb, ret); |
491 | 491 | ||
492 | /* Insert window size */ | 492 | /* Insert window size */ |
493 | ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, | 493 | ret = irda_param_insert(self, PI_WINDOW_SIZE, skb_tail_pointer(skb), |
494 | skb_tailroom(skb), &irlap_param_info); | 494 | skb_tailroom(skb), &irlap_param_info); |
495 | if (ret < 0) | 495 | if (ret < 0) |
496 | return ret; | 496 | return ret; |
497 | skb_put(skb, ret); | 497 | skb_put(skb, ret); |
498 | 498 | ||
499 | /* Insert additional BOFs */ | 499 | /* Insert additional BOFs */ |
500 | ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, | 500 | ret = irda_param_insert(self, PI_ADD_BOFS, skb_tail_pointer(skb), |
501 | skb_tailroom(skb), &irlap_param_info); | 501 | skb_tailroom(skb), &irlap_param_info); |
502 | if (ret < 0) | 502 | if (ret < 0) |
503 | return ret; | 503 | return ret; |
504 | skb_put(skb, ret); | 504 | skb_put(skb, ret); |
505 | 505 | ||
506 | /* Insert minimum turnaround time */ | 506 | /* Insert minimum turnaround time */ |
507 | ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, | 507 | ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb_tail_pointer(skb), |
508 | skb_tailroom(skb), &irlap_param_info); | 508 | skb_tailroom(skb), &irlap_param_info); |
509 | if (ret < 0) | 509 | if (ret < 0) |
510 | return ret; | 510 | return ret; |
511 | skb_put(skb, ret); | 511 | skb_put(skb, ret); |
512 | 512 | ||
513 | /* Insert link disconnect/threshold time */ | 513 | /* Insert link disconnect/threshold time */ |
514 | ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, | 514 | ret = irda_param_insert(self, PI_LINK_DISC, skb_tail_pointer(skb), |
515 | skb_tailroom(skb), &irlap_param_info); | 515 | skb_tailroom(skb), &irlap_param_info); |
516 | if (ret < 0) | 516 | if (ret < 0) |
517 | return ret; | 517 | return ret; |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 48f05314ebf7..442300c633d7 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -268,9 +268,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
268 | struct nlmsghdr *nlh; | 268 | struct nlmsghdr *nlh; |
269 | struct nfgenmsg *nfmsg; | 269 | struct nfgenmsg *nfmsg; |
270 | struct nfattr *nest_parms; | 270 | struct nfattr *nest_parms; |
271 | unsigned char *b; | 271 | unsigned char *b = skb_tail_pointer(skb); |
272 | |||
273 | b = skb->tail; | ||
274 | 272 | ||
275 | event |= NFNL_SUBSYS_CTNETLINK << 8; | 273 | event |= NFNL_SUBSYS_CTNETLINK << 8; |
276 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | 274 | 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, | |||
303 | ctnetlink_dump_use(skb, ct) < 0) | 301 | ctnetlink_dump_use(skb, ct) < 0) |
304 | goto nfattr_failure; | 302 | goto nfattr_failure; |
305 | 303 | ||
306 | nlh->nlmsg_len = skb->tail - b; | 304 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
307 | return skb->len; | 305 | return skb->len; |
308 | 306 | ||
309 | nlmsg_failure: | 307 | nlmsg_failure: |
@@ -322,7 +320,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, | |||
322 | struct nf_conn *ct = (struct nf_conn *)ptr; | 320 | struct nf_conn *ct = (struct nf_conn *)ptr; |
323 | struct sk_buff *skb; | 321 | struct sk_buff *skb; |
324 | unsigned int type; | 322 | unsigned int type; |
325 | unsigned char *b; | 323 | sk_buff_data_t b; |
326 | unsigned int flags = 0, group; | 324 | unsigned int flags = 0, group; |
327 | 325 | ||
328 | /* ignore our fake conntrack entry */ | 326 | /* ignore our fake conntrack entry */ |
@@ -1152,9 +1150,7 @@ ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1152 | { | 1150 | { |
1153 | struct nlmsghdr *nlh; | 1151 | struct nlmsghdr *nlh; |
1154 | struct nfgenmsg *nfmsg; | 1152 | struct nfgenmsg *nfmsg; |
1155 | unsigned char *b; | 1153 | unsigned char *b = skb_tail_pointer(skb); |
1156 | |||
1157 | b = skb->tail; | ||
1158 | 1154 | ||
1159 | event |= NFNL_SUBSYS_CTNETLINK_EXP << 8; | 1155 | event |= NFNL_SUBSYS_CTNETLINK_EXP << 8; |
1160 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | 1156 | 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, | |||
1168 | if (ctnetlink_exp_dump_expect(skb, exp) < 0) | 1164 | if (ctnetlink_exp_dump_expect(skb, exp) < 0) |
1169 | goto nfattr_failure; | 1165 | goto nfattr_failure; |
1170 | 1166 | ||
1171 | nlh->nlmsg_len = skb->tail - b; | 1167 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1172 | return skb->len; | 1168 | return skb->len; |
1173 | 1169 | ||
1174 | nlmsg_failure: | 1170 | nlmsg_failure: |
@@ -1186,7 +1182,7 @@ static int ctnetlink_expect_event(struct notifier_block *this, | |||
1186 | struct nf_conntrack_expect *exp = (struct nf_conntrack_expect *)ptr; | 1182 | struct nf_conntrack_expect *exp = (struct nf_conntrack_expect *)ptr; |
1187 | struct sk_buff *skb; | 1183 | struct sk_buff *skb; |
1188 | unsigned int type; | 1184 | unsigned int type; |
1189 | unsigned char *b; | 1185 | sk_buff_data_t b; |
1190 | int flags = 0; | 1186 | int flags = 0; |
1191 | 1187 | ||
1192 | if (events & IPEXP_NEW) { | 1188 | if (events & IPEXP_NEW) { |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 5eeebd2efa7a..9709f94787f8 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -409,15 +409,14 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
409 | const struct nf_loginfo *li, | 409 | const struct nf_loginfo *li, |
410 | const char *prefix, unsigned int plen) | 410 | const char *prefix, unsigned int plen) |
411 | { | 411 | { |
412 | unsigned char *old_tail; | ||
413 | struct nfulnl_msg_packet_hdr pmsg; | 412 | struct nfulnl_msg_packet_hdr pmsg; |
414 | struct nlmsghdr *nlh; | 413 | struct nlmsghdr *nlh; |
415 | struct nfgenmsg *nfmsg; | 414 | struct nfgenmsg *nfmsg; |
416 | __be32 tmp_uint; | 415 | __be32 tmp_uint; |
416 | sk_buff_data_t old_tail = inst->skb->tail; | ||
417 | 417 | ||
418 | UDEBUG("entered\n"); | 418 | UDEBUG("entered\n"); |
419 | 419 | ||
420 | old_tail = inst->skb->tail; | ||
421 | nlh = NLMSG_PUT(inst->skb, 0, 0, | 420 | nlh = NLMSG_PUT(inst->skb, 0, 0, |
422 | NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, | 421 | NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, |
423 | sizeof(struct nfgenmsg)); | 422 | sizeof(struct nfgenmsg)); |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index cfbee39f61d6..b6585caa431e 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -338,7 +338,7 @@ static struct sk_buff * | |||
338 | nfqnl_build_packet_message(struct nfqnl_instance *queue, | 338 | nfqnl_build_packet_message(struct nfqnl_instance *queue, |
339 | struct nfqnl_queue_entry *entry, int *errp) | 339 | struct nfqnl_queue_entry *entry, int *errp) |
340 | { | 340 | { |
341 | unsigned char *old_tail; | 341 | sk_buff_data_t old_tail; |
342 | size_t size; | 342 | size_t size; |
343 | size_t data_len = 0; | 343 | size_t data_len = 0; |
344 | struct sk_buff *skb; | 344 | struct sk_buff *skb; |
@@ -404,7 +404,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
404 | if (!skb) | 404 | if (!skb) |
405 | goto nlmsg_failure; | 405 | goto nlmsg_failure; |
406 | 406 | ||
407 | old_tail= skb->tail; | 407 | old_tail = skb->tail; |
408 | nlh = NLMSG_PUT(skb, 0, 0, | 408 | nlh = NLMSG_PUT(skb, 0, 0, |
409 | NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, | 409 | NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, |
410 | sizeof(struct nfgenmsg)); | 410 | sizeof(struct nfgenmsg)); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 50dc5edb7752..fdb6eb13cbcb 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -785,7 +785,7 @@ static inline struct sk_buff *netlink_trim(struct sk_buff *skb, | |||
785 | 785 | ||
786 | skb_orphan(skb); | 786 | skb_orphan(skb); |
787 | 787 | ||
788 | delta = skb->end - skb->tail; | 788 | delta = skb->end - skb_tail_pointer(skb); |
789 | if (delta * 2 < skb->truesize) | 789 | if (delta * 2 < skb->truesize) |
790 | return skb; | 790 | return skb; |
791 | 791 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 51c059b09a37..36388b2f32f9 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -775,7 +775,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
775 | err = -EINVAL; | 775 | err = -EINVAL; |
776 | res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); | 776 | res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); |
777 | if (sock->type != SOCK_DGRAM) { | 777 | if (sock->type != SOCK_DGRAM) { |
778 | skb->tail = skb->data; | 778 | skb_reset_tail_pointer(skb); |
779 | skb->len = 0; | 779 | skb->len = 0; |
780 | } else if (res < 0) | 780 | } else if (res < 0) |
781 | goto out_free; | 781 | goto out_free; |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index cb21617a5670..28326fb1fc4e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -93,7 +93,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
93 | continue; | 93 | continue; |
94 | a->priv = p; | 94 | a->priv = p; |
95 | a->order = n_i; | 95 | a->order = n_i; |
96 | r = (struct rtattr*) skb->tail; | 96 | r = (struct rtattr *)skb_tail_pointer(skb); |
97 | RTA_PUT(skb, a->order, 0, NULL); | 97 | RTA_PUT(skb, a->order, 0, NULL); |
98 | err = tcf_action_dump_1(skb, a, 0, 0); | 98 | err = tcf_action_dump_1(skb, a, 0, 0); |
99 | if (err < 0) { | 99 | if (err < 0) { |
@@ -101,7 +101,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
101 | skb_trim(skb, (u8*)r - skb->data); | 101 | skb_trim(skb, (u8*)r - skb->data); |
102 | goto done; | 102 | goto done; |
103 | } | 103 | } |
104 | r->rta_len = skb->tail - (u8*)r; | 104 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
105 | n_i++; | 105 | n_i++; |
106 | if (n_i >= TCA_ACT_MAX_PRIO) | 106 | if (n_i >= TCA_ACT_MAX_PRIO) |
107 | goto done; | 107 | goto done; |
@@ -125,7 +125,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
125 | struct rtattr *r ; | 125 | struct rtattr *r ; |
126 | int i= 0, n_i = 0; | 126 | int i= 0, n_i = 0; |
127 | 127 | ||
128 | r = (struct rtattr*) skb->tail; | 128 | r = (struct rtattr *)skb_tail_pointer(skb); |
129 | RTA_PUT(skb, a->order, 0, NULL); | 129 | RTA_PUT(skb, a->order, 0, NULL); |
130 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | 130 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); |
131 | for (i = 0; i < (hinfo->hmask + 1); i++) { | 131 | 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, | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | RTA_PUT(skb, TCA_FCNT, 4, &n_i); | 142 | RTA_PUT(skb, TCA_FCNT, 4, &n_i); |
143 | r->rta_len = skb->tail - (u8*)r; | 143 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
144 | 144 | ||
145 | return n_i; | 145 | return n_i; |
146 | rtattr_failure: | 146 | rtattr_failure: |
@@ -423,7 +423,7 @@ int | |||
423 | tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 423 | tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
424 | { | 424 | { |
425 | int err = -EINVAL; | 425 | int err = -EINVAL; |
426 | unsigned char *b = skb->tail; | 426 | unsigned char *b = skb_tail_pointer(skb); |
427 | struct rtattr *r; | 427 | struct rtattr *r; |
428 | 428 | ||
429 | if (a->ops == NULL || a->ops->dump == NULL) | 429 | 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) | |||
432 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | 432 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); |
433 | if (tcf_action_copy_stats(skb, a, 0)) | 433 | if (tcf_action_copy_stats(skb, a, 0)) |
434 | goto rtattr_failure; | 434 | goto rtattr_failure; |
435 | r = (struct rtattr*) skb->tail; | 435 | r = (struct rtattr *)skb_tail_pointer(skb); |
436 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 436 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
437 | if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { | 437 | if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { |
438 | r->rta_len = skb->tail - (u8*)r; | 438 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
439 | return err; | 439 | return err; |
440 | } | 440 | } |
441 | 441 | ||
@@ -449,17 +449,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref) | |||
449 | { | 449 | { |
450 | struct tc_action *a; | 450 | struct tc_action *a; |
451 | int err = -EINVAL; | 451 | int err = -EINVAL; |
452 | unsigned char *b = skb->tail; | 452 | unsigned char *b = skb_tail_pointer(skb); |
453 | struct rtattr *r ; | 453 | struct rtattr *r ; |
454 | 454 | ||
455 | while ((a = act) != NULL) { | 455 | while ((a = act) != NULL) { |
456 | r = (struct rtattr*) skb->tail; | 456 | r = (struct rtattr *)skb_tail_pointer(skb); |
457 | act = a->next; | 457 | act = a->next; |
458 | RTA_PUT(skb, a->order, 0, NULL); | 458 | RTA_PUT(skb, a->order, 0, NULL); |
459 | err = tcf_action_dump_1(skb, a, bind, ref); | 459 | err = tcf_action_dump_1(skb, a, bind, ref); |
460 | if (err < 0) | 460 | if (err < 0) |
461 | goto errout; | 461 | goto errout; |
462 | r->rta_len = skb->tail - (u8*)r; | 462 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
463 | } | 463 | } |
464 | 464 | ||
465 | return 0; | 465 | return 0; |
@@ -635,7 +635,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, | |||
635 | { | 635 | { |
636 | struct tcamsg *t; | 636 | struct tcamsg *t; |
637 | struct nlmsghdr *nlh; | 637 | struct nlmsghdr *nlh; |
638 | unsigned char *b = skb->tail; | 638 | unsigned char *b = skb_tail_pointer(skb); |
639 | struct rtattr *x; | 639 | struct rtattr *x; |
640 | 640 | ||
641 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | 641 | 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, | |||
645 | t->tca__pad1 = 0; | 645 | t->tca__pad1 = 0; |
646 | t->tca__pad2 = 0; | 646 | t->tca__pad2 = 0; |
647 | 647 | ||
648 | x = (struct rtattr*) skb->tail; | 648 | x = (struct rtattr *)skb_tail_pointer(skb); |
649 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 649 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
650 | 650 | ||
651 | if (tcf_action_dump(skb, a, bind, ref) < 0) | 651 | if (tcf_action_dump(skb, a, bind, ref) < 0) |
652 | goto rtattr_failure; | 652 | goto rtattr_failure; |
653 | 653 | ||
654 | x->rta_len = skb->tail - (u8*)x; | 654 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; |
655 | 655 | ||
656 | nlh->nlmsg_len = skb->tail - b; | 656 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
657 | return skb->len; | 657 | return skb->len; |
658 | 658 | ||
659 | rtattr_failure: | 659 | rtattr_failure: |
@@ -767,7 +767,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) | |||
767 | return -ENOBUFS; | 767 | return -ENOBUFS; |
768 | } | 768 | } |
769 | 769 | ||
770 | b = (unsigned char *)skb->tail; | 770 | b = skb_tail_pointer(skb); |
771 | 771 | ||
772 | if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0) | 772 | if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0) |
773 | goto err_out; | 773 | goto err_out; |
@@ -783,16 +783,16 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) | |||
783 | t->tca__pad1 = 0; | 783 | t->tca__pad1 = 0; |
784 | t->tca__pad2 = 0; | 784 | t->tca__pad2 = 0; |
785 | 785 | ||
786 | x = (struct rtattr *) skb->tail; | 786 | x = (struct rtattr *)skb_tail_pointer(skb); |
787 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 787 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
788 | 788 | ||
789 | err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); | 789 | err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); |
790 | if (err < 0) | 790 | if (err < 0) |
791 | goto rtattr_failure; | 791 | goto rtattr_failure; |
792 | 792 | ||
793 | x->rta_len = skb->tail - (u8 *) x; | 793 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; |
794 | 794 | ||
795 | nlh->nlmsg_len = skb->tail - b; | 795 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
796 | nlh->nlmsg_flags |= NLM_F_ROOT; | 796 | nlh->nlmsg_flags |= NLM_F_ROOT; |
797 | module_put(a->ops->owner); | 797 | module_put(a->ops->owner); |
798 | kfree(a); | 798 | kfree(a); |
@@ -884,7 +884,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | |||
884 | if (!skb) | 884 | if (!skb) |
885 | return -ENOBUFS; | 885 | return -ENOBUFS; |
886 | 886 | ||
887 | b = (unsigned char *)skb->tail; | 887 | b = skb_tail_pointer(skb); |
888 | 888 | ||
889 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | 889 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); |
890 | t = NLMSG_DATA(nlh); | 890 | t = NLMSG_DATA(nlh); |
@@ -892,15 +892,15 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | |||
892 | t->tca__pad1 = 0; | 892 | t->tca__pad1 = 0; |
893 | t->tca__pad2 = 0; | 893 | t->tca__pad2 = 0; |
894 | 894 | ||
895 | x = (struct rtattr*) skb->tail; | 895 | x = (struct rtattr *)skb_tail_pointer(skb); |
896 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 896 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
897 | 897 | ||
898 | if (tcf_action_dump(skb, a, 0, 0) < 0) | 898 | if (tcf_action_dump(skb, a, 0, 0) < 0) |
899 | goto rtattr_failure; | 899 | goto rtattr_failure; |
900 | 900 | ||
901 | x->rta_len = skb->tail - (u8*)x; | 901 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; |
902 | 902 | ||
903 | nlh->nlmsg_len = skb->tail - b; | 903 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
904 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; | 904 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; |
905 | 905 | ||
906 | err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); | 906 | err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); |
@@ -1015,7 +1015,7 @@ static int | |||
1015 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | 1015 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) |
1016 | { | 1016 | { |
1017 | struct nlmsghdr *nlh; | 1017 | struct nlmsghdr *nlh; |
1018 | unsigned char *b = skb->tail; | 1018 | unsigned char *b = skb_tail_pointer(skb); |
1019 | struct rtattr *x; | 1019 | struct rtattr *x; |
1020 | struct tc_action_ops *a_o; | 1020 | struct tc_action_ops *a_o; |
1021 | struct tc_action a; | 1021 | struct tc_action a; |
@@ -1048,7 +1048,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1048 | t->tca__pad1 = 0; | 1048 | t->tca__pad1 = 0; |
1049 | t->tca__pad2 = 0; | 1049 | t->tca__pad2 = 0; |
1050 | 1050 | ||
1051 | x = (struct rtattr *) skb->tail; | 1051 | x = (struct rtattr *)skb_tail_pointer(skb); |
1052 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 1052 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
1053 | 1053 | ||
1054 | ret = a_o->walk(skb, cb, RTM_GETACTION, &a); | 1054 | ret = a_o->walk(skb, cb, RTM_GETACTION, &a); |
@@ -1056,12 +1056,12 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1056 | goto rtattr_failure; | 1056 | goto rtattr_failure; |
1057 | 1057 | ||
1058 | if (ret > 0) { | 1058 | if (ret > 0) { |
1059 | x->rta_len = skb->tail - (u8 *) x; | 1059 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; |
1060 | ret = skb->len; | 1060 | ret = skb->len; |
1061 | } else | 1061 | } else |
1062 | skb_trim(skb, (u8*)x - skb->data); | 1062 | skb_trim(skb, (u8*)x - skb->data); |
1063 | 1063 | ||
1064 | nlh->nlmsg_len = skb->tail - b; | 1064 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1065 | if (NETLINK_CB(cb->skb).pid && ret) | 1065 | if (NETLINK_CB(cb->skb).pid && ret) |
1066 | nlh->nlmsg_flags |= NLM_F_MULTI; | 1066 | nlh->nlmsg_flags |= NLM_F_MULTI; |
1067 | module_put(a_o->owner); | 1067 | module_put(a_o->owner); |
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 87d0faf32867..aad748b3b38c 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -155,7 +155,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result | |||
155 | 155 | ||
156 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 156 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
157 | { | 157 | { |
158 | unsigned char *b = skb->tail; | 158 | unsigned char *b = skb_tail_pointer(skb); |
159 | struct tc_gact opt; | 159 | struct tc_gact opt; |
160 | struct tcf_gact *gact = a->priv; | 160 | struct tcf_gact *gact = a->priv; |
161 | struct tcf_t t; | 161 | struct tcf_t t; |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 47f0b1324239..2ccfd5b20fab 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -245,7 +245,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, | |||
245 | 245 | ||
246 | static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 246 | static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
247 | { | 247 | { |
248 | unsigned char *b = skb->tail; | 248 | unsigned char *b = skb_tail_pointer(skb); |
249 | struct tcf_ipt *ipt = a->priv; | 249 | struct tcf_ipt *ipt = a->priv; |
250 | struct ipt_entry_target *t; | 250 | struct ipt_entry_target *t; |
251 | struct tcf_t tm; | 251 | struct tcf_t tm; |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 3e93683e9ab3..15f6ecdaf611 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -206,7 +206,7 @@ bad_mirred: | |||
206 | 206 | ||
207 | static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 207 | static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
208 | { | 208 | { |
209 | unsigned char *b = skb->tail; | 209 | unsigned char *b = skb_tail_pointer(skb); |
210 | struct tcf_mirred *m = a->priv; | 210 | struct tcf_mirred *m = a->priv; |
211 | struct tc_mirred opt; | 211 | struct tc_mirred opt; |
212 | struct tcf_t t; | 212 | struct tcf_t t; |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 20813eee8af4..d654cea1a46c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -195,7 +195,7 @@ done: | |||
195 | static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, | 195 | static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, |
196 | int bind, int ref) | 196 | int bind, int ref) |
197 | { | 197 | { |
198 | unsigned char *b = skb->tail; | 198 | unsigned char *b = skb_tail_pointer(skb); |
199 | struct tcf_pedit *p = a->priv; | 199 | struct tcf_pedit *p = a->priv; |
200 | struct tc_pedit *opt; | 200 | struct tc_pedit *opt; |
201 | struct tcf_t t; | 201 | struct tcf_t t; |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 10a5a5c36f76..068b23763665 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -80,7 +80,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c | |||
80 | continue; | 80 | continue; |
81 | a->priv = p; | 81 | a->priv = p; |
82 | a->order = index; | 82 | a->order = index; |
83 | r = (struct rtattr*) skb->tail; | 83 | r = (struct rtattr *)skb_tail_pointer(skb); |
84 | RTA_PUT(skb, a->order, 0, NULL); | 84 | RTA_PUT(skb, a->order, 0, NULL); |
85 | if (type == RTM_DELACTION) | 85 | if (type == RTM_DELACTION) |
86 | err = tcf_action_dump_1(skb, a, 0, 1); | 86 | 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 | |||
91 | skb_trim(skb, (u8*)r - skb->data); | 91 | skb_trim(skb, (u8*)r - skb->data); |
92 | goto done; | 92 | goto done; |
93 | } | 93 | } |
94 | r->rta_len = skb->tail - (u8*)r; | 94 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
95 | n_i++; | 95 | n_i++; |
96 | } | 96 | } |
97 | } | 97 | } |
@@ -326,7 +326,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, | |||
326 | static int | 326 | static int |
327 | tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 327 | tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
328 | { | 328 | { |
329 | unsigned char *b = skb->tail; | 329 | unsigned char *b = skb_tail_pointer(skb); |
330 | struct tcf_police *police = a->priv; | 330 | struct tcf_police *police = a->priv; |
331 | struct tc_police opt; | 331 | struct tc_police opt; |
332 | 332 | ||
@@ -572,7 +572,7 @@ EXPORT_SYMBOL(tcf_police); | |||
572 | 572 | ||
573 | int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police) | 573 | int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police) |
574 | { | 574 | { |
575 | unsigned char *b = skb->tail; | 575 | unsigned char *b = skb_tail_pointer(skb); |
576 | struct tc_police opt; | 576 | struct tc_police opt; |
577 | 577 | ||
578 | opt.index = police->tcf_index; | 578 | opt.index = police->tcf_index; |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index c7971182af07..ecbcfa59b76c 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -155,7 +155,7 @@ static inline int tcf_simp_cleanup(struct tc_action *a, int bind) | |||
155 | static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | 155 | static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, |
156 | int bind, int ref) | 156 | int bind, int ref) |
157 | { | 157 | { |
158 | unsigned char *b = skb->tail; | 158 | unsigned char *b = skb_tail_pointer(skb); |
159 | struct tcf_defact *d = a->priv; | 159 | struct tcf_defact *d = a->priv; |
160 | struct tc_defact opt; | 160 | struct tc_defact opt; |
161 | struct tcf_t t; | 161 | struct tcf_t t; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5c6ffdb77d2d..84231baf77d1 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -323,7 +323,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | |||
323 | { | 323 | { |
324 | struct tcmsg *tcm; | 324 | struct tcmsg *tcm; |
325 | struct nlmsghdr *nlh; | 325 | struct nlmsghdr *nlh; |
326 | unsigned char *b = skb->tail; | 326 | unsigned char *b = skb_tail_pointer(skb); |
327 | 327 | ||
328 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 328 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); |
329 | tcm = NLMSG_DATA(nlh); | 329 | tcm = NLMSG_DATA(nlh); |
@@ -340,7 +340,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | |||
340 | if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) | 340 | if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) |
341 | goto rtattr_failure; | 341 | goto rtattr_failure; |
342 | } | 342 | } |
343 | nlh->nlmsg_len = skb->tail - b; | 343 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
344 | return skb->len; | 344 | return skb->len; |
345 | 345 | ||
346 | nlmsg_failure: | 346 | nlmsg_failure: |
@@ -563,30 +563,30 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, | |||
563 | * to work with both old and new modes of entering | 563 | * to work with both old and new modes of entering |
564 | * tc data even if iproute2 was newer - jhs | 564 | * tc data even if iproute2 was newer - jhs |
565 | */ | 565 | */ |
566 | struct rtattr * p_rta = (struct rtattr*) skb->tail; | 566 | struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb); |
567 | 567 | ||
568 | if (exts->action->type != TCA_OLD_COMPAT) { | 568 | if (exts->action->type != TCA_OLD_COMPAT) { |
569 | RTA_PUT(skb, map->action, 0, NULL); | 569 | RTA_PUT(skb, map->action, 0, NULL); |
570 | if (tcf_action_dump(skb, exts->action, 0, 0) < 0) | 570 | if (tcf_action_dump(skb, exts->action, 0, 0) < 0) |
571 | goto rtattr_failure; | 571 | goto rtattr_failure; |
572 | p_rta->rta_len = skb->tail - (u8*)p_rta; | 572 | p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; |
573 | } else if (map->police) { | 573 | } else if (map->police) { |
574 | RTA_PUT(skb, map->police, 0, NULL); | 574 | RTA_PUT(skb, map->police, 0, NULL); |
575 | if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) | 575 | if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) |
576 | goto rtattr_failure; | 576 | goto rtattr_failure; |
577 | p_rta->rta_len = skb->tail - (u8*)p_rta; | 577 | p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; |
578 | } | 578 | } |
579 | } | 579 | } |
580 | #elif defined CONFIG_NET_CLS_POLICE | 580 | #elif defined CONFIG_NET_CLS_POLICE |
581 | if (map->police && exts->police) { | 581 | if (map->police && exts->police) { |
582 | struct rtattr * p_rta = (struct rtattr*) skb->tail; | 582 | struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb); |
583 | 583 | ||
584 | RTA_PUT(skb, map->police, 0, NULL); | 584 | RTA_PUT(skb, map->police, 0, NULL); |
585 | 585 | ||
586 | if (tcf_police_dump(skb, exts->police) < 0) | 586 | if (tcf_police_dump(skb, exts->police) < 0) |
587 | goto rtattr_failure; | 587 | goto rtattr_failure; |
588 | 588 | ||
589 | p_rta->rta_len = skb->tail - (u8*)p_rta; | 589 | p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; |
590 | } | 590 | } |
591 | #endif | 591 | #endif |
592 | return 0; | 592 | return 0; |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 4a91f082a81d..800ec2ac326b 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -245,7 +245,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | |||
245 | struct sk_buff *skb, struct tcmsg *t) | 245 | struct sk_buff *skb, struct tcmsg *t) |
246 | { | 246 | { |
247 | struct basic_filter *f = (struct basic_filter *) fh; | 247 | struct basic_filter *f = (struct basic_filter *) fh; |
248 | unsigned char *b = skb->tail; | 248 | unsigned char *b = skb_tail_pointer(skb); |
249 | struct rtattr *rta; | 249 | struct rtattr *rta; |
250 | 250 | ||
251 | if (f == NULL) | 251 | if (f == NULL) |
@@ -263,7 +263,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | |||
263 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | 263 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) |
264 | goto rtattr_failure; | 264 | goto rtattr_failure; |
265 | 265 | ||
266 | rta->rta_len = (skb->tail - b); | 266 | rta->rta_len = skb_tail_pointer(skb) - b; |
267 | return skb->len; | 267 | return skb->len; |
268 | 268 | ||
269 | rtattr_failure: | 269 | rtattr_failure: |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 5dbb9d451f73..f5f355852a87 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -348,7 +348,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | |||
348 | { | 348 | { |
349 | struct fw_head *head = (struct fw_head *)tp->root; | 349 | struct fw_head *head = (struct fw_head *)tp->root; |
350 | struct fw_filter *f = (struct fw_filter*)fh; | 350 | struct fw_filter *f = (struct fw_filter*)fh; |
351 | unsigned char *b = skb->tail; | 351 | unsigned char *b = skb_tail_pointer(skb); |
352 | struct rtattr *rta; | 352 | struct rtattr *rta; |
353 | 353 | ||
354 | if (f == NULL) | 354 | if (f == NULL) |
@@ -374,7 +374,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | |||
374 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) | 374 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) |
375 | goto rtattr_failure; | 375 | goto rtattr_failure; |
376 | 376 | ||
377 | rta->rta_len = skb->tail - b; | 377 | rta->rta_len = skb_tail_pointer(skb) - b; |
378 | 378 | ||
379 | if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0) | 379 | if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0) |
380 | goto rtattr_failure; | 380 | goto rtattr_failure; |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index abc47cc48ad0..1f94df36239d 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -562,7 +562,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | |||
562 | struct sk_buff *skb, struct tcmsg *t) | 562 | struct sk_buff *skb, struct tcmsg *t) |
563 | { | 563 | { |
564 | struct route4_filter *f = (struct route4_filter*)fh; | 564 | struct route4_filter *f = (struct route4_filter*)fh; |
565 | unsigned char *b = skb->tail; | 565 | unsigned char *b = skb_tail_pointer(skb); |
566 | struct rtattr *rta; | 566 | struct rtattr *rta; |
567 | u32 id; | 567 | u32 id; |
568 | 568 | ||
@@ -591,7 +591,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | |||
591 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | 591 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) |
592 | goto rtattr_failure; | 592 | goto rtattr_failure; |
593 | 593 | ||
594 | rta->rta_len = skb->tail - b; | 594 | rta->rta_len = skb_tail_pointer(skb) - b; |
595 | 595 | ||
596 | if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) | 596 | if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) |
597 | goto rtattr_failure; | 597 | goto rtattr_failure; |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 6f373b020eb4..87ed6f3c5070 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -593,7 +593,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | |||
593 | { | 593 | { |
594 | struct rsvp_filter *f = (struct rsvp_filter*)fh; | 594 | struct rsvp_filter *f = (struct rsvp_filter*)fh; |
595 | struct rsvp_session *s; | 595 | struct rsvp_session *s; |
596 | unsigned char *b = skb->tail; | 596 | unsigned char *b = skb_tail_pointer(skb); |
597 | struct rtattr *rta; | 597 | struct rtattr *rta; |
598 | struct tc_rsvp_pinfo pinfo; | 598 | struct tc_rsvp_pinfo pinfo; |
599 | 599 | ||
@@ -623,7 +623,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | |||
623 | if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) | 623 | if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) |
624 | goto rtattr_failure; | 624 | goto rtattr_failure; |
625 | 625 | ||
626 | rta->rta_len = skb->tail - b; | 626 | rta->rta_len = skb_tail_pointer(skb) - b; |
627 | 627 | ||
628 | if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) | 628 | if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) |
629 | goto rtattr_failure; | 629 | goto rtattr_failure; |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 7563fdcef4b7..0537d6066b43 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -448,7 +448,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
448 | { | 448 | { |
449 | struct tcindex_data *p = PRIV(tp); | 449 | struct tcindex_data *p = PRIV(tp); |
450 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; | 450 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; |
451 | unsigned char *b = skb->tail; | 451 | unsigned char *b = skb_tail_pointer(skb); |
452 | struct rtattr *rta; | 452 | struct rtattr *rta; |
453 | 453 | ||
454 | DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", | 454 | 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, | |||
463 | RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); | 463 | RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); |
464 | RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), | 464 | RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), |
465 | &p->fall_through); | 465 | &p->fall_through); |
466 | rta->rta_len = skb->tail-b; | 466 | rta->rta_len = skb_tail_pointer(skb) - b; |
467 | } else { | 467 | } else { |
468 | if (p->perfect) { | 468 | if (p->perfect) { |
469 | t->tcm_handle = r-p->perfect; | 469 | t->tcm_handle = r-p->perfect; |
@@ -486,7 +486,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
486 | 486 | ||
487 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 487 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) |
488 | goto rtattr_failure; | 488 | goto rtattr_failure; |
489 | rta->rta_len = skb->tail-b; | 489 | rta->rta_len = skb_tail_pointer(skb) - b; |
490 | 490 | ||
491 | if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) | 491 | if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) |
492 | goto rtattr_failure; | 492 | goto rtattr_failure; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 695b34051b9f..fa11bb750049 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -213,7 +213,7 @@ check_terminal: | |||
213 | off2 = 0; | 213 | off2 = 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | if (ptr < skb->tail) | 216 | if (ptr < skb_tail_pointer(skb)) |
217 | goto next_ht; | 217 | goto next_ht; |
218 | } | 218 | } |
219 | 219 | ||
@@ -718,7 +718,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
718 | struct sk_buff *skb, struct tcmsg *t) | 718 | struct sk_buff *skb, struct tcmsg *t) |
719 | { | 719 | { |
720 | struct tc_u_knode *n = (struct tc_u_knode*)fh; | 720 | struct tc_u_knode *n = (struct tc_u_knode*)fh; |
721 | unsigned char *b = skb->tail; | 721 | unsigned char *b = skb_tail_pointer(skb); |
722 | struct rtattr *rta; | 722 | struct rtattr *rta; |
723 | 723 | ||
724 | if (n == NULL) | 724 | if (n == NULL) |
@@ -765,7 +765,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
765 | #endif | 765 | #endif |
766 | } | 766 | } |
767 | 767 | ||
768 | rta->rta_len = skb->tail - b; | 768 | rta->rta_len = skb_tail_pointer(skb) - b; |
769 | if (TC_U32_KEY(n->handle)) | 769 | if (TC_U32_KEY(n->handle)) |
770 | if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) | 770 | if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) |
771 | goto rtattr_failure; | 771 | goto rtattr_failure; |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 959c306c5714..63146d339d81 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -418,17 +418,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) | |||
418 | int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | 418 | int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) |
419 | { | 419 | { |
420 | int i; | 420 | int i; |
421 | struct rtattr * top_start = (struct rtattr*) skb->tail; | 421 | u8 *tail; |
422 | struct rtattr * list_start; | 422 | struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb); |
423 | struct rtattr *list_start; | ||
423 | 424 | ||
424 | RTA_PUT(skb, tlv, 0, NULL); | 425 | RTA_PUT(skb, tlv, 0, NULL); |
425 | RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); | 426 | RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); |
426 | 427 | ||
427 | list_start = (struct rtattr *) skb->tail; | 428 | list_start = (struct rtattr *)skb_tail_pointer(skb); |
428 | RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); | 429 | RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); |
429 | 430 | ||
431 | tail = skb_tail_pointer(skb); | ||
430 | for (i = 0; i < tree->hdr.nmatches; i++) { | 432 | for (i = 0; i < tree->hdr.nmatches; i++) { |
431 | struct rtattr *match_start = (struct rtattr*) skb->tail; | 433 | struct rtattr *match_start = (struct rtattr *)tail; |
432 | struct tcf_ematch *em = tcf_em_get_match(tree, i); | 434 | struct tcf_ematch *em = tcf_em_get_match(tree, i); |
433 | struct tcf_ematch_hdr em_hdr = { | 435 | struct tcf_ematch_hdr em_hdr = { |
434 | .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, | 436 | .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) | |||
447 | } else if (em->datalen > 0) | 449 | } else if (em->datalen > 0) |
448 | RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); | 450 | RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); |
449 | 451 | ||
450 | match_start->rta_len = skb->tail - (u8*) match_start; | 452 | tail = skb_tail_pointer(skb); |
453 | match_start->rta_len = tail - (u8 *)match_start; | ||
451 | } | 454 | } |
452 | 455 | ||
453 | list_start->rta_len = skb->tail - (u8 *) list_start; | 456 | list_start->rta_len = tail - (u8 *)list_start; |
454 | top_start->rta_len = skb->tail - (u8 *) top_start; | 457 | top_start->rta_len = tail - (u8 *)top_start; |
455 | 458 | ||
456 | return 0; | 459 | return 0; |
457 | 460 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index ecbdc6b42a9c..7482a950717b 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -813,7 +813,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
813 | { | 813 | { |
814 | struct tcmsg *tcm; | 814 | struct tcmsg *tcm; |
815 | struct nlmsghdr *nlh; | 815 | struct nlmsghdr *nlh; |
816 | unsigned char *b = skb->tail; | 816 | unsigned char *b = skb_tail_pointer(skb); |
817 | struct gnet_dump d; | 817 | struct gnet_dump d; |
818 | 818 | ||
819 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 819 | 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, | |||
847 | if (gnet_stats_finish_copy(&d) < 0) | 847 | if (gnet_stats_finish_copy(&d) < 0) |
848 | goto rtattr_failure; | 848 | goto rtattr_failure; |
849 | 849 | ||
850 | nlh->nlmsg_len = skb->tail - b; | 850 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
851 | return skb->len; | 851 | return skb->len; |
852 | 852 | ||
853 | nlmsg_failure: | 853 | nlmsg_failure: |
@@ -1051,7 +1051,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1051 | { | 1051 | { |
1052 | struct tcmsg *tcm; | 1052 | struct tcmsg *tcm; |
1053 | struct nlmsghdr *nlh; | 1053 | struct nlmsghdr *nlh; |
1054 | unsigned char *b = skb->tail; | 1054 | unsigned char *b = skb_tail_pointer(skb); |
1055 | struct gnet_dump d; | 1055 | struct gnet_dump d; |
1056 | struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; | 1056 | struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; |
1057 | 1057 | ||
@@ -1076,7 +1076,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1076 | if (gnet_stats_finish_copy(&d) < 0) | 1076 | if (gnet_stats_finish_copy(&d) < 0) |
1077 | goto rtattr_failure; | 1077 | goto rtattr_failure; |
1078 | 1078 | ||
1079 | nlh->nlmsg_len = skb->tail - b; | 1079 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1080 | return skb->len; | 1080 | return skb->len; |
1081 | 1081 | ||
1082 | nlmsg_failure: | 1082 | nlmsg_failure: |
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index baca8743c12b..1d7bb1632138 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -631,7 +631,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
631 | { | 631 | { |
632 | struct atm_qdisc_data *p = PRIV(sch); | 632 | struct atm_qdisc_data *p = PRIV(sch); |
633 | struct atm_flow_data *flow = (struct atm_flow_data *) cl; | 633 | struct atm_flow_data *flow = (struct atm_flow_data *) cl; |
634 | unsigned char *b = skb->tail; | 634 | unsigned char *b = skb_tail_pointer(skb); |
635 | struct rtattr *rta; | 635 | struct rtattr *rta; |
636 | 636 | ||
637 | DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", | 637 | 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, | |||
661 | 661 | ||
662 | RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); | 662 | RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); |
663 | } | 663 | } |
664 | rta->rta_len = skb->tail-b; | 664 | rta->rta_len = skb_tail_pointer(skb) - b; |
665 | return skb->len; | 665 | return skb->len; |
666 | 666 | ||
667 | rtattr_failure: | 667 | rtattr_failure: |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index d83414d828d8..be98a01253e9 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1465,7 +1465,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt) | |||
1465 | 1465 | ||
1466 | static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) | 1466 | static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) |
1467 | { | 1467 | { |
1468 | unsigned char *b = skb->tail; | 1468 | unsigned char *b = skb_tail_pointer(skb); |
1469 | 1469 | ||
1470 | RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); | 1470 | RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); |
1471 | return skb->len; | 1471 | return skb->len; |
@@ -1477,7 +1477,7 @@ rtattr_failure: | |||
1477 | 1477 | ||
1478 | static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) | 1478 | static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) |
1479 | { | 1479 | { |
1480 | unsigned char *b = skb->tail; | 1480 | unsigned char *b = skb_tail_pointer(skb); |
1481 | struct tc_cbq_lssopt opt; | 1481 | struct tc_cbq_lssopt opt; |
1482 | 1482 | ||
1483 | opt.flags = 0; | 1483 | opt.flags = 0; |
@@ -1502,7 +1502,7 @@ rtattr_failure: | |||
1502 | 1502 | ||
1503 | static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | 1503 | static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) |
1504 | { | 1504 | { |
1505 | unsigned char *b = skb->tail; | 1505 | unsigned char *b = skb_tail_pointer(skb); |
1506 | struct tc_cbq_wrropt opt; | 1506 | struct tc_cbq_wrropt opt; |
1507 | 1507 | ||
1508 | opt.flags = 0; | 1508 | opt.flags = 0; |
@@ -1520,7 +1520,7 @@ rtattr_failure: | |||
1520 | 1520 | ||
1521 | static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) | 1521 | static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) |
1522 | { | 1522 | { |
1523 | unsigned char *b = skb->tail; | 1523 | unsigned char *b = skb_tail_pointer(skb); |
1524 | struct tc_cbq_ovl opt; | 1524 | struct tc_cbq_ovl opt; |
1525 | 1525 | ||
1526 | opt.strategy = cl->ovl_strategy; | 1526 | opt.strategy = cl->ovl_strategy; |
@@ -1537,7 +1537,7 @@ rtattr_failure: | |||
1537 | 1537 | ||
1538 | static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) | 1538 | static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) |
1539 | { | 1539 | { |
1540 | unsigned char *b = skb->tail; | 1540 | unsigned char *b = skb_tail_pointer(skb); |
1541 | struct tc_cbq_fopt opt; | 1541 | struct tc_cbq_fopt opt; |
1542 | 1542 | ||
1543 | if (cl->split || cl->defmap) { | 1543 | if (cl->split || cl->defmap) { |
@@ -1556,7 +1556,7 @@ rtattr_failure: | |||
1556 | #ifdef CONFIG_NET_CLS_POLICE | 1556 | #ifdef CONFIG_NET_CLS_POLICE |
1557 | static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) | 1557 | static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) |
1558 | { | 1558 | { |
1559 | unsigned char *b = skb->tail; | 1559 | unsigned char *b = skb_tail_pointer(skb); |
1560 | struct tc_cbq_police opt; | 1560 | struct tc_cbq_police opt; |
1561 | 1561 | ||
1562 | if (cl->police) { | 1562 | if (cl->police) { |
@@ -1590,14 +1590,14 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl) | |||
1590 | static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) | 1590 | static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) |
1591 | { | 1591 | { |
1592 | struct cbq_sched_data *q = qdisc_priv(sch); | 1592 | struct cbq_sched_data *q = qdisc_priv(sch); |
1593 | unsigned char *b = skb->tail; | 1593 | unsigned char *b = skb_tail_pointer(skb); |
1594 | struct rtattr *rta; | 1594 | struct rtattr *rta; |
1595 | 1595 | ||
1596 | rta = (struct rtattr*)b; | 1596 | rta = (struct rtattr*)b; |
1597 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1597 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
1598 | if (cbq_dump_attr(skb, &q->link) < 0) | 1598 | if (cbq_dump_attr(skb, &q->link) < 0) |
1599 | goto rtattr_failure; | 1599 | goto rtattr_failure; |
1600 | rta->rta_len = skb->tail - b; | 1600 | rta->rta_len = skb_tail_pointer(skb) - b; |
1601 | return skb->len; | 1601 | return skb->len; |
1602 | 1602 | ||
1603 | rtattr_failure: | 1603 | rtattr_failure: |
@@ -1619,7 +1619,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1619 | struct sk_buff *skb, struct tcmsg *tcm) | 1619 | struct sk_buff *skb, struct tcmsg *tcm) |
1620 | { | 1620 | { |
1621 | struct cbq_class *cl = (struct cbq_class*)arg; | 1621 | struct cbq_class *cl = (struct cbq_class*)arg; |
1622 | unsigned char *b = skb->tail; | 1622 | unsigned char *b = skb_tail_pointer(skb); |
1623 | struct rtattr *rta; | 1623 | struct rtattr *rta; |
1624 | 1624 | ||
1625 | if (cl->tparent) | 1625 | if (cl->tparent) |
@@ -1633,7 +1633,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1633 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1633 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
1634 | if (cbq_dump_attr(skb, cl) < 0) | 1634 | if (cbq_dump_attr(skb, cl) < 0) |
1635 | goto rtattr_failure; | 1635 | goto rtattr_failure; |
1636 | rta->rta_len = skb->tail - b; | 1636 | rta->rta_len = skb_tail_pointer(skb) - b; |
1637 | return skb->len; | 1637 | return skb->len; |
1638 | 1638 | ||
1639 | rtattr_failure: | 1639 | rtattr_failure: |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 5197b6caaf2d..80e6f811e3bc 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1363,7 +1363,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, | |||
1363 | struct tcmsg *tcm) | 1363 | struct tcmsg *tcm) |
1364 | { | 1364 | { |
1365 | struct hfsc_class *cl = (struct hfsc_class *)arg; | 1365 | struct hfsc_class *cl = (struct hfsc_class *)arg; |
1366 | unsigned char *b = skb->tail; | 1366 | unsigned char *b = skb_tail_pointer(skb); |
1367 | struct rtattr *rta = (struct rtattr *)b; | 1367 | struct rtattr *rta = (struct rtattr *)b; |
1368 | 1368 | ||
1369 | tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT; | 1369 | 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, | |||
1374 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1374 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
1375 | if (hfsc_dump_curves(skb, cl) < 0) | 1375 | if (hfsc_dump_curves(skb, cl) < 0) |
1376 | goto rtattr_failure; | 1376 | goto rtattr_failure; |
1377 | rta->rta_len = skb->tail - b; | 1377 | rta->rta_len = skb_tail_pointer(skb) - b; |
1378 | return skb->len; | 1378 | return skb->len; |
1379 | 1379 | ||
1380 | rtattr_failure: | 1380 | rtattr_failure: |
@@ -1576,7 +1576,7 @@ static int | |||
1576 | hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) | 1576 | hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) |
1577 | { | 1577 | { |
1578 | struct hfsc_sched *q = qdisc_priv(sch); | 1578 | struct hfsc_sched *q = qdisc_priv(sch); |
1579 | unsigned char *b = skb->tail; | 1579 | unsigned char *b = skb_tail_pointer(skb); |
1580 | struct tc_hfsc_qopt qopt; | 1580 | struct tc_hfsc_qopt qopt; |
1581 | 1581 | ||
1582 | qopt.defcls = q->defcls; | 1582 | qopt.defcls = q->defcls; |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index f76c20c0a109..c687388a8cb6 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1110,7 +1110,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt) | |||
1110 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | 1110 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) |
1111 | { | 1111 | { |
1112 | struct htb_sched *q = qdisc_priv(sch); | 1112 | struct htb_sched *q = qdisc_priv(sch); |
1113 | unsigned char *b = skb->tail; | 1113 | unsigned char *b = skb_tail_pointer(skb); |
1114 | struct rtattr *rta; | 1114 | struct rtattr *rta; |
1115 | struct tc_htb_glob gopt; | 1115 | struct tc_htb_glob gopt; |
1116 | spin_lock_bh(&sch->dev->queue_lock); | 1116 | spin_lock_bh(&sch->dev->queue_lock); |
@@ -1123,12 +1123,12 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
1123 | rta = (struct rtattr *)b; | 1123 | rta = (struct rtattr *)b; |
1124 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1124 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
1125 | RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); | 1125 | RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); |
1126 | rta->rta_len = skb->tail - b; | 1126 | rta->rta_len = skb_tail_pointer(skb) - b; |
1127 | spin_unlock_bh(&sch->dev->queue_lock); | 1127 | spin_unlock_bh(&sch->dev->queue_lock); |
1128 | return skb->len; | 1128 | return skb->len; |
1129 | rtattr_failure: | 1129 | rtattr_failure: |
1130 | spin_unlock_bh(&sch->dev->queue_lock); | 1130 | spin_unlock_bh(&sch->dev->queue_lock); |
1131 | skb_trim(skb, skb->tail - skb->data); | 1131 | skb_trim(skb, skb_tail_pointer(skb) - skb->data); |
1132 | return -1; | 1132 | return -1; |
1133 | } | 1133 | } |
1134 | 1134 | ||
@@ -1136,7 +1136,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1136 | struct sk_buff *skb, struct tcmsg *tcm) | 1136 | struct sk_buff *skb, struct tcmsg *tcm) |
1137 | { | 1137 | { |
1138 | struct htb_class *cl = (struct htb_class *)arg; | 1138 | struct htb_class *cl = (struct htb_class *)arg; |
1139 | unsigned char *b = skb->tail; | 1139 | unsigned char *b = skb_tail_pointer(skb); |
1140 | struct rtattr *rta; | 1140 | struct rtattr *rta; |
1141 | struct tc_htb_opt opt; | 1141 | struct tc_htb_opt opt; |
1142 | 1142 | ||
@@ -1159,7 +1159,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1159 | opt.prio = cl->un.leaf.prio; | 1159 | opt.prio = cl->un.leaf.prio; |
1160 | opt.level = cl->level; | 1160 | opt.level = cl->level; |
1161 | RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); | 1161 | RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); |
1162 | rta->rta_len = skb->tail - b; | 1162 | rta->rta_len = skb_tail_pointer(skb) - b; |
1163 | spin_unlock_bh(&sch->dev->queue_lock); | 1163 | spin_unlock_bh(&sch->dev->queue_lock); |
1164 | return skb->len; | 1164 | return skb->len; |
1165 | rtattr_failure: | 1165 | rtattr_failure: |
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index cfe070ee6ee3..d19f4070c237 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c | |||
@@ -362,12 +362,12 @@ static void ingress_destroy(struct Qdisc *sch) | |||
362 | 362 | ||
363 | static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) | 363 | static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) |
364 | { | 364 | { |
365 | unsigned char *b = skb->tail; | 365 | unsigned char *b = skb_tail_pointer(skb); |
366 | struct rtattr *rta; | 366 | struct rtattr *rta; |
367 | 367 | ||
368 | rta = (struct rtattr *) b; | 368 | rta = (struct rtattr *) b; |
369 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 369 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
370 | rta->rta_len = skb->tail - b; | 370 | rta->rta_len = skb_tail_pointer(skb) - b; |
371 | return skb->len; | 371 | return skb->len; |
372 | 372 | ||
373 | rtattr_failure: | 373 | rtattr_failure: |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 915f82a2cc3d..2a9b1e429ff8 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -583,7 +583,7 @@ static void netem_destroy(struct Qdisc *sch) | |||
583 | static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | 583 | static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) |
584 | { | 584 | { |
585 | const struct netem_sched_data *q = qdisc_priv(sch); | 585 | const struct netem_sched_data *q = qdisc_priv(sch); |
586 | unsigned char *b = skb->tail; | 586 | unsigned char *b = skb_tail_pointer(skb); |
587 | struct rtattr *rta = (struct rtattr *) b; | 587 | struct rtattr *rta = (struct rtattr *) b; |
588 | struct tc_netem_qopt qopt; | 588 | struct tc_netem_qopt qopt; |
589 | struct tc_netem_corr cor; | 589 | struct tc_netem_corr cor; |
@@ -611,7 +611,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
611 | corrupt.correlation = q->corrupt_cor.rho; | 611 | corrupt.correlation = q->corrupt_cor.rho; |
612 | RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); | 612 | RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); |
613 | 613 | ||
614 | rta->rta_len = skb->tail - b; | 614 | rta->rta_len = skb_tail_pointer(skb) - b; |
615 | 615 | ||
616 | return skb->len; | 616 | return skb->len; |
617 | 617 | ||
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index de889f23f22a..5b371109ec1c 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -271,7 +271,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt) | |||
271 | static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) | 271 | static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) |
272 | { | 272 | { |
273 | struct prio_sched_data *q = qdisc_priv(sch); | 273 | struct prio_sched_data *q = qdisc_priv(sch); |
274 | unsigned char *b = skb->tail; | 274 | unsigned char *b = skb_tail_pointer(skb); |
275 | struct tc_prio_qopt opt; | 275 | struct tc_prio_qopt opt; |
276 | 276 | ||
277 | opt.bands = q->bands; | 277 | opt.bands = q->bands; |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index e3695407afc6..a511ba83e26f 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -461,7 +461,7 @@ static void sfq_destroy(struct Qdisc *sch) | |||
461 | static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) | 461 | static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) |
462 | { | 462 | { |
463 | struct sfq_sched_data *q = qdisc_priv(sch); | 463 | struct sfq_sched_data *q = qdisc_priv(sch); |
464 | unsigned char *b = skb->tail; | 464 | unsigned char *b = skb_tail_pointer(skb); |
465 | struct tc_sfq_qopt opt; | 465 | struct tc_sfq_qopt opt; |
466 | 466 | ||
467 | opt.quantum = q->quantum; | 467 | opt.quantum = q->quantum; |
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index f14692f3a14e..231895562c66 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -387,7 +387,7 @@ static void tbf_destroy(struct Qdisc *sch) | |||
387 | static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) | 387 | static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) |
388 | { | 388 | { |
389 | struct tbf_sched_data *q = qdisc_priv(sch); | 389 | struct tbf_sched_data *q = qdisc_priv(sch); |
390 | unsigned char *b = skb->tail; | 390 | unsigned char *b = skb_tail_pointer(skb); |
391 | struct rtattr *rta; | 391 | struct rtattr *rta; |
392 | struct tc_tbf_qopt opt; | 392 | struct tc_tbf_qopt opt; |
393 | 393 | ||
@@ -403,7 +403,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
403 | opt.mtu = q->mtu; | 403 | opt.mtu = q->mtu; |
404 | opt.buffer = q->buffer; | 404 | opt.buffer = q->buffer; |
405 | RTA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt); | 405 | RTA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt); |
406 | rta->rta_len = skb->tail - b; | 406 | rta->rta_len = skb_tail_pointer(skb) - b; |
407 | 407 | ||
408 | return skb->len; | 408 | return skb->len; |
409 | 409 | ||
diff --git a/net/sctp/input.c b/net/sctp/input.c index 1ff47b18724a..18b97eedc1fa 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -612,7 +612,7 @@ int sctp_rcv_ootb(struct sk_buff *skb) | |||
612 | break; | 612 | break; |
613 | 613 | ||
614 | ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); | 614 | ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); |
615 | if (ch_end > skb->tail) | 615 | if (ch_end > skb_tail_pointer(skb)) |
616 | break; | 616 | break; |
617 | 617 | ||
618 | /* RFC 8.4, 2) If the OOTB packet contains an ABORT chunk, the | 618 | /* 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) | |||
644 | } | 644 | } |
645 | 645 | ||
646 | ch = (sctp_chunkhdr_t *) ch_end; | 646 | ch = (sctp_chunkhdr_t *) ch_end; |
647 | } while (ch_end < skb->tail); | 647 | } while (ch_end < skb_tail_pointer(skb)); |
648 | 648 | ||
649 | return 0; | 649 | return 0; |
650 | 650 | ||
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index c30629e17781..88aa22407549 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c | |||
@@ -159,16 +159,16 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) | |||
159 | * the skb->tail. | 159 | * the skb->tail. |
160 | */ | 160 | */ |
161 | if (unlikely(skb_is_nonlinear(chunk->skb))) { | 161 | if (unlikely(skb_is_nonlinear(chunk->skb))) { |
162 | if (chunk->chunk_end > chunk->skb->tail) | 162 | if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) |
163 | chunk->chunk_end = chunk->skb->tail; | 163 | chunk->chunk_end = skb_tail_pointer(chunk->skb); |
164 | } | 164 | } |
165 | skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); | 165 | skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); |
166 | chunk->subh.v = NULL; /* Subheader is no longer valid. */ | 166 | chunk->subh.v = NULL; /* Subheader is no longer valid. */ |
167 | 167 | ||
168 | if (chunk->chunk_end < chunk->skb->tail) { | 168 | if (chunk->chunk_end < skb_tail_pointer(chunk->skb)) { |
169 | /* This is not a singleton */ | 169 | /* This is not a singleton */ |
170 | chunk->singleton = 0; | 170 | chunk->singleton = 0; |
171 | } else if (chunk->chunk_end > chunk->skb->tail) { | 171 | } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { |
172 | /* RFC 2960, Section 6.10 Bundling | 172 | /* RFC 2960, Section 6.10 Bundling |
173 | * | 173 | * |
174 | * Partial chunks MUST NOT be placed in an SCTP packet. | 174 | * Partial chunks MUST NOT be placed in an SCTP packet. |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 60c5b59d4c65..759ea3d19976 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1143,7 +1143,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) | |||
1143 | 1143 | ||
1144 | /* Adjust the chunk length field. */ | 1144 | /* Adjust the chunk length field. */ |
1145 | chunk->chunk_hdr->length = htons(chunklen + padlen + len); | 1145 | chunk->chunk_hdr->length = htons(chunklen + padlen + len); |
1146 | chunk->chunk_end = chunk->skb->tail; | 1146 | chunk->chunk_end = skb_tail_pointer(chunk->skb); |
1147 | 1147 | ||
1148 | return target; | 1148 | return target; |
1149 | } | 1149 | } |
@@ -1168,7 +1168,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, | |||
1168 | /* Adjust the chunk length field. */ | 1168 | /* Adjust the chunk length field. */ |
1169 | chunk->chunk_hdr->length = | 1169 | chunk->chunk_hdr->length = |
1170 | htons(ntohs(chunk->chunk_hdr->length) + len); | 1170 | htons(ntohs(chunk->chunk_hdr->length) + len); |
1171 | chunk->chunk_end = chunk->skb->tail; | 1171 | chunk->chunk_end = skb_tail_pointer(chunk->skb); |
1172 | 1172 | ||
1173 | out: | 1173 | out: |
1174 | return err; | 1174 | return err; |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index bf502c499c81..438e5dc5c714 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -3115,7 +3115,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep, | |||
3115 | break; | 3115 | break; |
3116 | 3116 | ||
3117 | ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); | 3117 | ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); |
3118 | if (ch_end > skb->tail) | 3118 | if (ch_end > skb_tail_pointer(skb)) |
3119 | break; | 3119 | break; |
3120 | 3120 | ||
3121 | if (SCTP_CID_SHUTDOWN_ACK == ch->type) | 3121 | if (SCTP_CID_SHUTDOWN_ACK == ch->type) |
@@ -3130,7 +3130,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep, | |||
3130 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); | 3130 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
3131 | 3131 | ||
3132 | ch = (sctp_chunkhdr_t *) ch_end; | 3132 | ch = (sctp_chunkhdr_t *) ch_end; |
3133 | } while (ch_end < skb->tail); | 3133 | } while (ch_end < skb_tail_pointer(skb)); |
3134 | 3134 | ||
3135 | if (ootb_shut_ack) | 3135 | if (ootb_shut_ack) |
3136 | sctp_sf_shut_8_4_5(ep, asoc, type, arg, commands); | 3136 | sctp_sf_shut_8_4_5(ep, asoc, type, arg, commands); |
diff --git a/net/tipc/config.c b/net/tipc/config.c index 14789a82de53..c71337a22d33 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -89,7 +89,7 @@ struct sk_buff *tipc_cfg_reply_alloc(int payload_size) | |||
89 | int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, | 89 | int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, |
90 | void *tlv_data, int tlv_data_size) | 90 | void *tlv_data, int tlv_data_size) |
91 | { | 91 | { |
92 | struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; | 92 | struct tlv_desc *tlv = (struct tlv_desc *)skb_tail_pointer(buf); |
93 | int new_tlv_space = TLV_SPACE(tlv_data_size); | 93 | int new_tlv_space = TLV_SPACE(tlv_data_size); |
94 | 94 | ||
95 | if (skb_tailroom(buf) < new_tlv_space) { | 95 | if (skb_tailroom(buf) < new_tlv_space) { |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index b71739fbe2c6..45832fb75ea4 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1020,7 +1020,7 @@ restart: | |||
1020 | 1020 | ||
1021 | if (!err) { | 1021 | if (!err) { |
1022 | buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle); | 1022 | buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle); |
1023 | sz = buf->tail - buf_crs; | 1023 | sz = skb_tail_pointer(buf) - buf_crs; |
1024 | 1024 | ||
1025 | needed = (buf_len - sz_copied); | 1025 | needed = (buf_len - sz_copied); |
1026 | sz_to_copy = (sz <= needed) ? sz : needed; | 1026 | sz_to_copy = (sz <= needed) ? sz : needed; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 816e3690b60f..814bb3125ada 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -576,7 +576,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr) | |||
576 | struct sk_buff *skb = sp->out_skb; | 576 | struct sk_buff *skb = sp->out_skb; |
577 | struct xfrm_usersa_info *p; | 577 | struct xfrm_usersa_info *p; |
578 | struct nlmsghdr *nlh; | 578 | struct nlmsghdr *nlh; |
579 | unsigned char *b = skb->tail; | 579 | unsigned char *b = skb_tail_pointer(skb); |
580 | 580 | ||
581 | if (sp->this_idx < sp->start_idx) | 581 | if (sp->this_idx < sp->start_idx) |
582 | goto out; | 582 | goto out; |
@@ -621,7 +621,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr) | |||
621 | if (x->lastused) | 621 | if (x->lastused) |
622 | RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused); | 622 | RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused); |
623 | 623 | ||
624 | nlh->nlmsg_len = skb->tail - b; | 624 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
625 | out: | 625 | out: |
626 | sp->this_idx++; | 626 | sp->this_idx++; |
627 | return 0; | 627 | return 0; |
@@ -1157,7 +1157,7 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr | |||
1157 | struct sk_buff *in_skb = sp->in_skb; | 1157 | struct sk_buff *in_skb = sp->in_skb; |
1158 | struct sk_buff *skb = sp->out_skb; | 1158 | struct sk_buff *skb = sp->out_skb; |
1159 | struct nlmsghdr *nlh; | 1159 | struct nlmsghdr *nlh; |
1160 | unsigned char *b = skb->tail; | 1160 | unsigned char *b = skb_tail_pointer(skb); |
1161 | 1161 | ||
1162 | if (sp->this_idx < sp->start_idx) | 1162 | if (sp->this_idx < sp->start_idx) |
1163 | goto out; | 1163 | goto out; |
@@ -1176,7 +1176,7 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr | |||
1176 | if (copy_to_user_policy_type(xp->type, skb) < 0) | 1176 | if (copy_to_user_policy_type(xp->type, skb) < 0) |
1177 | goto nlmsg_failure; | 1177 | goto nlmsg_failure; |
1178 | 1178 | ||
1179 | nlh->nlmsg_len = skb->tail - b; | 1179 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1180 | out: | 1180 | out: |
1181 | sp->this_idx++; | 1181 | sp->this_idx++; |
1182 | return 0; | 1182 | return 0; |
@@ -1330,7 +1330,7 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, struct km_eve | |||
1330 | struct xfrm_aevent_id *id; | 1330 | struct xfrm_aevent_id *id; |
1331 | struct nlmsghdr *nlh; | 1331 | struct nlmsghdr *nlh; |
1332 | struct xfrm_lifetime_cur ltime; | 1332 | struct xfrm_lifetime_cur ltime; |
1333 | unsigned char *b = skb->tail; | 1333 | unsigned char *b = skb_tail_pointer(skb); |
1334 | 1334 | ||
1335 | nlh = NLMSG_PUT(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id)); | 1335 | nlh = NLMSG_PUT(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id)); |
1336 | id = NLMSG_DATA(nlh); | 1336 | id = NLMSG_DATA(nlh); |
@@ -1362,7 +1362,7 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, struct km_eve | |||
1362 | RTA_PUT(skb,XFRMA_ETIMER_THRESH,sizeof(u32),&etimer); | 1362 | RTA_PUT(skb,XFRMA_ETIMER_THRESH,sizeof(u32),&etimer); |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | nlh->nlmsg_len = skb->tail - b; | 1365 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1366 | return skb->len; | 1366 | return skb->len; |
1367 | 1367 | ||
1368 | rtattr_failure: | 1368 | rtattr_failure: |
@@ -1744,7 +1744,7 @@ static int build_migrate(struct sk_buff *skb, struct xfrm_migrate *m, | |||
1744 | struct xfrm_migrate *mp; | 1744 | struct xfrm_migrate *mp; |
1745 | struct xfrm_userpolicy_id *pol_id; | 1745 | struct xfrm_userpolicy_id *pol_id; |
1746 | struct nlmsghdr *nlh; | 1746 | struct nlmsghdr *nlh; |
1747 | unsigned char *b = skb->tail; | 1747 | unsigned char *b = skb_tail_pointer(skb); |
1748 | int i; | 1748 | int i; |
1749 | 1749 | ||
1750 | nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_MIGRATE, sizeof(*pol_id)); | 1750 | 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, | |||
1764 | goto nlmsg_failure; | 1764 | goto nlmsg_failure; |
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | nlh->nlmsg_len = skb->tail - b; | 1767 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1768 | return skb->len; | 1768 | return skb->len; |
1769 | nlmsg_failure: | 1769 | nlmsg_failure: |
1770 | skb_trim(skb, b - skb->data); | 1770 | 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 | |||
1942 | { | 1942 | { |
1943 | struct xfrm_user_expire *ue; | 1943 | struct xfrm_user_expire *ue; |
1944 | struct nlmsghdr *nlh; | 1944 | struct nlmsghdr *nlh; |
1945 | unsigned char *b = skb->tail; | 1945 | unsigned char *b = skb_tail_pointer(skb); |
1946 | 1946 | ||
1947 | nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_EXPIRE, | 1947 | nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_EXPIRE, |
1948 | sizeof(*ue)); | 1948 | sizeof(*ue)); |
@@ -1952,7 +1952,7 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, struct km_eve | |||
1952 | copy_to_user_state(x, &ue->state); | 1952 | copy_to_user_state(x, &ue->state); |
1953 | ue->hard = (c->data.hard != 0) ? 1 : 0; | 1953 | ue->hard = (c->data.hard != 0) ? 1 : 0; |
1954 | 1954 | ||
1955 | nlh->nlmsg_len = skb->tail - b; | 1955 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1956 | return skb->len; | 1956 | return skb->len; |
1957 | 1957 | ||
1958 | nlmsg_failure: | 1958 | nlmsg_failure: |
@@ -1999,7 +1999,7 @@ static int xfrm_notify_sa_flush(struct km_event *c) | |||
1999 | struct xfrm_usersa_flush *p; | 1999 | struct xfrm_usersa_flush *p; |
2000 | struct nlmsghdr *nlh; | 2000 | struct nlmsghdr *nlh; |
2001 | struct sk_buff *skb; | 2001 | struct sk_buff *skb; |
2002 | unsigned char *b; | 2002 | sk_buff_data_t b; |
2003 | int len = NLMSG_LENGTH(sizeof(struct xfrm_usersa_flush)); | 2003 | int len = NLMSG_LENGTH(sizeof(struct xfrm_usersa_flush)); |
2004 | 2004 | ||
2005 | skb = alloc_skb(len, GFP_ATOMIC); | 2005 | skb = alloc_skb(len, GFP_ATOMIC); |
@@ -2045,7 +2045,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, struct km_event *c) | |||
2045 | struct xfrm_usersa_id *id; | 2045 | struct xfrm_usersa_id *id; |
2046 | struct nlmsghdr *nlh; | 2046 | struct nlmsghdr *nlh; |
2047 | struct sk_buff *skb; | 2047 | struct sk_buff *skb; |
2048 | unsigned char *b; | 2048 | sk_buff_data_t b; |
2049 | int len = xfrm_sa_len(x); | 2049 | int len = xfrm_sa_len(x); |
2050 | int headlen; | 2050 | int headlen; |
2051 | 2051 | ||
@@ -2129,7 +2129,7 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, | |||
2129 | { | 2129 | { |
2130 | struct xfrm_user_acquire *ua; | 2130 | struct xfrm_user_acquire *ua; |
2131 | struct nlmsghdr *nlh; | 2131 | struct nlmsghdr *nlh; |
2132 | unsigned char *b = skb->tail; | 2132 | unsigned char *b = skb_tail_pointer(skb); |
2133 | __u32 seq = xfrm_get_acqseq(); | 2133 | __u32 seq = xfrm_get_acqseq(); |
2134 | 2134 | ||
2135 | nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_ACQUIRE, | 2135 | 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, | |||
2153 | if (copy_to_user_policy_type(xp->type, skb) < 0) | 2153 | if (copy_to_user_policy_type(xp->type, skb) < 0) |
2154 | goto nlmsg_failure; | 2154 | goto nlmsg_failure; |
2155 | 2155 | ||
2156 | nlh->nlmsg_len = skb->tail - b; | 2156 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
2157 | return skb->len; | 2157 | return skb->len; |
2158 | 2158 | ||
2159 | nlmsg_failure: | 2159 | nlmsg_failure: |
@@ -2249,7 +2249,7 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp, | |||
2249 | struct xfrm_user_polexpire *upe; | 2249 | struct xfrm_user_polexpire *upe; |
2250 | struct nlmsghdr *nlh; | 2250 | struct nlmsghdr *nlh; |
2251 | int hard = c->data.hard; | 2251 | int hard = c->data.hard; |
2252 | unsigned char *b = skb->tail; | 2252 | unsigned char *b = skb_tail_pointer(skb); |
2253 | 2253 | ||
2254 | nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe)); | 2254 | nlh = NLMSG_PUT(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe)); |
2255 | upe = NLMSG_DATA(nlh); | 2255 | upe = NLMSG_DATA(nlh); |
@@ -2264,7 +2264,7 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp, | |||
2264 | goto nlmsg_failure; | 2264 | goto nlmsg_failure; |
2265 | upe->hard = !!hard; | 2265 | upe->hard = !!hard; |
2266 | 2266 | ||
2267 | nlh->nlmsg_len = skb->tail - b; | 2267 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
2268 | return skb->len; | 2268 | return skb->len; |
2269 | 2269 | ||
2270 | nlmsg_failure: | 2270 | nlmsg_failure: |
@@ -2300,7 +2300,7 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event * | |||
2300 | struct xfrm_userpolicy_id *id; | 2300 | struct xfrm_userpolicy_id *id; |
2301 | struct nlmsghdr *nlh; | 2301 | struct nlmsghdr *nlh; |
2302 | struct sk_buff *skb; | 2302 | struct sk_buff *skb; |
2303 | unsigned char *b; | 2303 | sk_buff_data_t b; |
2304 | int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); | 2304 | int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
2305 | int headlen; | 2305 | int headlen; |
2306 | 2306 | ||
@@ -2357,7 +2357,7 @@ static int xfrm_notify_policy_flush(struct km_event *c) | |||
2357 | { | 2357 | { |
2358 | struct nlmsghdr *nlh; | 2358 | struct nlmsghdr *nlh; |
2359 | struct sk_buff *skb; | 2359 | struct sk_buff *skb; |
2360 | unsigned char *b; | 2360 | sk_buff_data_t b; |
2361 | int len = 0; | 2361 | int len = 0; |
2362 | #ifdef CONFIG_XFRM_SUB_POLICY | 2362 | #ifdef CONFIG_XFRM_SUB_POLICY |
2363 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); | 2363 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); |
@@ -2410,7 +2410,7 @@ static int build_report(struct sk_buff *skb, u8 proto, | |||
2410 | { | 2410 | { |
2411 | struct xfrm_user_report *ur; | 2411 | struct xfrm_user_report *ur; |
2412 | struct nlmsghdr *nlh; | 2412 | struct nlmsghdr *nlh; |
2413 | unsigned char *b = skb->tail; | 2413 | unsigned char *b = skb_tail_pointer(skb); |
2414 | 2414 | ||
2415 | nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_REPORT, sizeof(*ur)); | 2415 | nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_REPORT, sizeof(*ur)); |
2416 | ur = NLMSG_DATA(nlh); | 2416 | ur = NLMSG_DATA(nlh); |
@@ -2422,7 +2422,7 @@ static int build_report(struct sk_buff *skb, u8 proto, | |||
2422 | if (addr) | 2422 | if (addr) |
2423 | RTA_PUT(skb, XFRMA_COADDR, sizeof(*addr), addr); | 2423 | RTA_PUT(skb, XFRMA_COADDR, sizeof(*addr), addr); |
2424 | 2424 | ||
2425 | nlh->nlmsg_len = skb->tail - b; | 2425 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
2426 | return skb->len; | 2426 | return skb->len; |
2427 | 2427 | ||
2428 | nlmsg_failure: | 2428 | nlmsg_failure: |
diff --git a/security/selinux/netlink.c b/security/selinux/netlink.c index e203883406dd..33f2e064a682 100644 --- a/security/selinux/netlink.c +++ b/security/selinux/netlink.c | |||
@@ -66,7 +66,7 @@ static void selnl_add_payload(struct nlmsghdr *nlh, int len, int msgtype, void * | |||
66 | static void selnl_notify(int msgtype, void *data) | 66 | static void selnl_notify(int msgtype, void *data) |
67 | { | 67 | { |
68 | int len; | 68 | int len; |
69 | unsigned char *tmp; | 69 | sk_buff_data_t tmp; |
70 | struct sk_buff *skb; | 70 | struct sk_buff *skb; |
71 | struct nlmsghdr *nlh; | 71 | struct nlmsghdr *nlh; |
72 | 72 | ||