提交 61f83d0d 编写于 作者: A Alexei Starovoitov 提交者: David S. Miller

net: filter: fix warning on 32-bit arch

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: NFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NAlexei Starovoitov <ast@plumgrid.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 02c00c2a
...@@ -537,7 +537,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins ...@@ -537,7 +537,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins
* BPF_R0 - 8/16/32-bit skb data converted to cpu endianness * 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)) { if (likely(ptr != NULL)) {
BPF_R0 = get_unaligned_be32(ptr); BPF_R0 = get_unaligned_be32(ptr);
CONT; CONT;
...@@ -547,7 +547,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins ...@@ -547,7 +547,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins
LD_ABS_H: /* BPF_R0 = ntohs(*(u16 *) (skb->data + imm32)) */ LD_ABS_H: /* BPF_R0 = ntohs(*(u16 *) (skb->data + imm32)) */
off = IMM; off = IMM;
load_half: 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)) { if (likely(ptr != NULL)) {
BPF_R0 = get_unaligned_be16(ptr); BPF_R0 = get_unaligned_be16(ptr);
CONT; CONT;
...@@ -557,7 +557,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins ...@@ -557,7 +557,7 @@ static unsigned int __sk_run_filter(void *ctx, const struct sock_filter_int *ins
LD_ABS_B: /* BPF_R0 = *(u8 *) (skb->data + imm32) */ LD_ABS_B: /* BPF_R0 = *(u8 *) (skb->data + imm32) */
off = IMM; off = IMM;
load_byte: 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)) { if (likely(ptr != NULL)) {
BPF_R0 = *(u8 *)ptr; BPF_R0 = *(u8 *)ptr;
CONT; CONT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册