ipv6: fix headroom calculation in udp6_ufo_fragment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

Following a recent commit to LTS and upstream  I see the following warning emitted on an ARM32 build:

net/ipv6/udp_offload.c: In function 'udp6_ufo_fragment':
net/ipv6/udp_offload.c:88:22: error: comparison between pointer and integer [-Werror]
  if (skb->mac_header < (tnl_hlen + frag_hdr_sz)) {
                      ^
cc1: all warnings being treated as errors
make[2]: *** [net/ipv6/udp_offload.o] Error 1
make[1]: *** [net/ipv6] Error 2

 The commit made the following changes:

-       if (skb_headroom(skb) < (tnl_hlen + frag_hdr_sz)) {
+       if (skb->mac_header < (tnl_hlen + frag_hdr_sz)) {

Now, because of some defines in skbuff.h :

#if BITS_PER_LONG > 32
#define NET_SKBUFF_DATA_USES_OFFSET 1
#endif

#ifdef NET_SKBUFF_DATA_USES_OFFSET
typedef unsigned int sk_buff_data_t;
#else
typedef unsigned char *sk_buff_data_t;
#endif

On an ARM32 system sk_buff_data_t would be a pointer (long being 32 bits), meaning that skb->mac_header is a pointer and that  you are comparing a pointer against a length, which doesn't look like it is correct to me?

I can see how this works when NET_SKBUFF_DATA_USES_OFFSET is defined, but is there a way to do this that works for both cases?

Hope this makes sense, 

Mark

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]