Skip to content

Commit

Permalink
netfilter: xtables: fix warnings on 32bit platforms
Browse files Browse the repository at this point in the history
On 32bit archs gcc complains due to cast from void* to u64.
Add intermediate casts to long to silence these warnings.

include/linux/netfilter/x_tables.h:376:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
include/linux/netfilter/x_tables.h:384:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
include/linux/netfilter/x_tables.h:391:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
include/linux/netfilter/x_tables.h:400:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Fixes: 71ae0df ("netfilter: xtables: use percpu rule counters")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed Jun 18, 2015
1 parent 8f481b5 commit dcb8f5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/linux/netfilter/x_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,22 @@ static inline u64 xt_percpu_counter_alloc(void)
if (res == NULL)
return (u64) -ENOMEM;

return (__force u64) res;
return (u64) (__force unsigned long) res;
}

return 0;
}
static inline void xt_percpu_counter_free(u64 pcnt)
{
if (nr_cpu_ids > 1)
free_percpu((void __percpu *) pcnt);
free_percpu((void __percpu *) (unsigned long) pcnt);
}

static inline struct xt_counters *
xt_get_this_cpu_counter(struct xt_counters *cnt)
{
if (nr_cpu_ids > 1)
return this_cpu_ptr((void __percpu *) cnt->pcnt);
return this_cpu_ptr((void __percpu *) (unsigned long) cnt->pcnt);

return cnt;
}
Expand All @@ -396,7 +396,7 @@ static inline struct xt_counters *
xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu)
{
if (nr_cpu_ids > 1)
return per_cpu_ptr((void __percpu *) cnt->pcnt, cpu);
return per_cpu_ptr((void __percpu *) (unsigned long) cnt->pcnt, cpu);

return cnt;
}
Expand Down

0 comments on commit dcb8f5c

Please sign in to comment.