aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--net/core/skbuff.c16
2 files changed, 7 insertions, 13 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5f931191cf57..b9997907a0f1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1593,7 +1593,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1593} 1593}
1594static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1594static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1595{ 1595{
1596 return skb->transport_header != ~0U; 1596 return skb->transport_header != (typeof(skb->transport_header))~0U;
1597} 1597}
1598 1598
1599static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1599static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1636,7 +1636,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1636 1636
1637static inline int skb_mac_header_was_set(const struct sk_buff *skb) 1637static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1638{ 1638{
1639 return skb->mac_header != ~0U; 1639 return skb->mac_header != (typeof(skb->mac_header))~0U;
1640} 1640}
1641 1641
1642static inline void skb_reset_mac_header(struct sk_buff *skb) 1642static inline void skb_reset_mac_header(struct sk_buff *skb)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f45de077ab9e..6b1b52c5593b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -199,9 +199,7 @@ struct sk_buff *__alloc_skb_head(gfp_t gfp_mask, int node)
199 skb->truesize = sizeof(struct sk_buff); 199 skb->truesize = sizeof(struct sk_buff);
200 atomic_set(&skb->users, 1); 200 atomic_set(&skb->users, 1);
201 201
202#ifdef NET_SKBUFF_DATA_USES_OFFSET 202 skb->mac_header = (typeof(skb->mac_header))~0U;
203 skb->mac_header = (__u16) ~0U;
204#endif
205out: 203out:
206 return skb; 204 return skb;
207} 205}
@@ -275,10 +273,8 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
275 skb->data = data; 273 skb->data = data;
276 skb_reset_tail_pointer(skb); 274 skb_reset_tail_pointer(skb);
277 skb->end = skb->tail + size; 275 skb->end = skb->tail + size;
278#ifdef NET_SKBUFF_DATA_USES_OFFSET 276 skb->mac_header = (typeof(skb->mac_header))~0U;
279 skb->mac_header = (__u16) ~0U; 277 skb->transport_header = (typeof(skb->transport_header))~0U;
280 skb->transport_header = (__u16) ~0U;
281#endif
282 278
283 /* make sure we initialize shinfo sequentially */ 279 /* make sure we initialize shinfo sequentially */
284 shinfo = skb_shinfo(skb); 280 shinfo = skb_shinfo(skb);
@@ -344,10 +340,8 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
344 skb->data = data; 340 skb->data = data;
345 skb_reset_tail_pointer(skb); 341 skb_reset_tail_pointer(skb);
346 skb->end = skb->tail + size; 342 skb->end = skb->tail + size;
347#ifdef NET_SKBUFF_DATA_USES_OFFSET 343 skb->mac_header = (typeof(skb->mac_header))~0U;
348 skb->mac_header = (__u16) ~0U; 344 skb->transport_header = (typeof(skb->transport_header))~0U;
349 skb->transport_header = (__u16) ~0U;
350#endif
351 345
352 /* make sure we initialize shinfo sequentially */ 346 /* make sure we initialize shinfo sequentially */
353 shinfo = skb_shinfo(skb); 347 shinfo = skb_shinfo(skb);