Commit c2636b4d authored by Chuck Lever's avatar Chuck Lever Committed by David S. Miller

[NET]: Treat the sign of the result of skb_headroom() consistently

In some places, the result of skb_headroom() is compared to an unsigned
integer, and in others, the result is compared to a signed integer.  Make
the comparisons consistent and correct.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ffdd581
...@@ -994,7 +994,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) ...@@ -994,7 +994,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
* *
* Return the number of bytes of free space at the head of an &sk_buff. * Return the number of bytes of free space at the head of an &sk_buff.
*/ */
static inline int skb_headroom(const struct sk_buff *skb) static inline unsigned int skb_headroom(const struct sk_buff *skb)
{ {
return skb->data - skb->head; return skb->data - skb->head;
} }
...@@ -1347,7 +1347,7 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, ...@@ -1347,7 +1347,7 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
* Returns true if modifying the header part of the cloned buffer * Returns true if modifying the header part of the cloned buffer
* does not requires the data to be copied. * does not requires the data to be copied.
*/ */
static inline int skb_clone_writable(struct sk_buff *skb, int len) static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
{ {
return !skb_header_cloned(skb) && return !skb_header_cloned(skb) &&
skb_headroom(skb) + len <= skb->hdr_len; skb_headroom(skb) + len <= skb->hdr_len;
......
...@@ -674,7 +674,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -674,7 +674,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct rtable *rt; /* Route to the other host */ struct rtable *rt; /* Route to the other host */
struct net_device *tdev; /* Device to other host */ struct net_device *tdev; /* Device to other host */
struct iphdr *iph; /* Our new IP header */ struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */ unsigned int max_headroom; /* The extra header space needed */
int gre_hlen; int gre_hlen;
__be32 dst; __be32 dst;
int mtu; int mtu;
......
...@@ -161,7 +161,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) ...@@ -161,7 +161,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
struct dst_entry *dst = skb->dst; struct dst_entry *dst = skb->dst;
struct rtable *rt = (struct rtable *)dst; struct rtable *rt = (struct rtable *)dst;
struct net_device *dev = dst->dev; struct net_device *dev = dst->dev;
int hh_len = LL_RESERVED_SPACE(dev); unsigned int hh_len = LL_RESERVED_SPACE(dev);
if (rt->rt_type == RTN_MULTICAST) if (rt->rt_type == RTN_MULTICAST)
IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
......
...@@ -515,7 +515,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -515,7 +515,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct net_device *tdev; /* Device to other host */ struct net_device *tdev; /* Device to other host */
struct iphdr *old_iph = ip_hdr(skb); struct iphdr *old_iph = ip_hdr(skb);
struct iphdr *iph; /* Our new IP header */ struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */ unsigned int max_headroom; /* The extra header space needed */
__be32 dst = tiph->daddr; __be32 dst = tiph->daddr;
int mtu; int mtu;
......
...@@ -325,7 +325,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, ...@@ -325,7 +325,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
__be16 df = old_iph->frag_off; __be16 df = old_iph->frag_off;
sk_buff_data_t old_transport_header = skb->transport_header; sk_buff_data_t old_transport_header = skb->transport_header;
struct iphdr *iph; /* Our new IP header */ struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */ unsigned int max_headroom; /* The extra header space needed */
int mtu; int mtu;
EnterFunction(10); EnterFunction(10);
......
...@@ -3909,7 +3909,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, ...@@ -3909,7 +3909,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
while (before(start, end)) { while (before(start, end)) {
struct sk_buff *nskb; struct sk_buff *nskb;
int header = skb_headroom(skb); unsigned int header = skb_headroom(skb);
int copy = SKB_MAX_ORDER(header, 0); int copy = SKB_MAX_ORDER(header, 0);
/* Too big header? This can happen with IPv6. */ /* Too big header? This can happen with IPv6. */
......
...@@ -171,7 +171,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -171,7 +171,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
u32 mtu; u32 mtu;
if (opt) { if (opt) {
int head_room; unsigned int head_room;
/* First: exthdrs may take lots of space (~8K for now) /* First: exthdrs may take lots of space (~8K for now)
MAX_HEADER is not enough. MAX_HEADER is not enough.
......
...@@ -838,7 +838,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -838,7 +838,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
struct dst_entry *dst; struct dst_entry *dst;
struct net_device *tdev; struct net_device *tdev;
int mtu; int mtu;
int max_headroom = sizeof(struct ipv6hdr); unsigned int max_headroom = sizeof(struct ipv6hdr);
u8 proto; u8 proto;
int err = -1; int err = -1;
int pkt_len; int pkt_len;
......
...@@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct rtable *rt; /* Route to the other host */ struct rtable *rt; /* Route to the other host */
struct net_device *tdev; /* Device to other host */ struct net_device *tdev; /* Device to other host */
struct iphdr *iph; /* Our new IP header */ struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */ unsigned int max_headroom; /* The extra header space needed */
__be32 dst = tiph->daddr; __be32 dst = tiph->daddr;
int mtu; int mtu;
struct in6_addr *addr6; struct in6_addr *addr6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment