net: filter: fix warning on 32-bit arch
authorAlexei Starovoitov <ast@plumgrid.com>
Wed, 11 Jun 2014 20:16:44 +0000 (13:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Jun 2014 22:12:27 +0000 (15:12 -0700)
fix compiler warning on 32-bit architectures:

net/core/filter.c: In function '__sk_run_filter':
net/core/filter.c:540:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
net/core/filter.c:550:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
net/core/filter.c:560:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/filter.c

index b3f21751b2386a6deb224c41fd005e4d5da9fc47..735fad89749630b71b2b64d6c82d59fec60a7c7f 100644 (file)
@@ -537,7 +537,7 @@ load_word:
                 *   BPF_R0 - 8/16/32-bit skb data converted to cpu endianness
                 */
 
-               ptr = load_pointer((struct sk_buff *) CTX, off, 4, &tmp);
+               ptr = load_pointer((struct sk_buff *) (unsigned long) CTX, off, 4, &tmp);
                if (likely(ptr != NULL)) {
                        BPF_R0 = get_unaligned_be32(ptr);
                        CONT;
@@ -547,7 +547,7 @@ load_word:
        LD_ABS_H: /* BPF_R0 = ntohs(*(u16 *) (skb->data + imm32)) */
                off = IMM;
 load_half:
-               ptr = load_pointer((struct sk_buff *) CTX, off, 2, &tmp);
+               ptr = load_pointer((struct sk_buff *) (unsigned long) CTX, off, 2, &tmp);
                if (likely(ptr != NULL)) {
                        BPF_R0 = get_unaligned_be16(ptr);
                        CONT;
@@ -557,7 +557,7 @@ load_half:
        LD_ABS_B: /* BPF_R0 = *(u8 *) (skb->data + imm32) */
                off = IMM;
 load_byte:
-               ptr = load_pointer((struct sk_buff *) CTX, off, 1, &tmp);
+               ptr = load_pointer((struct sk_buff *) (unsigned long) CTX, off, 1, &tmp);
                if (likely(ptr != NULL)) {
                        BPF_R0 = *(u8 *)ptr;
                        CONT;