History

netfilter: xtables: fix warnings on 32bit platforms

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]

Florian Westphal committed 11 years ago

Commit dcb8f5c1 parent 8f481b51 file · +4 −4Browse files

Showing the changes to include/linux/netfilter (1 of 1 file). Show all

Unified · Split

include/linux/netfilter/x_tables.h+4−4
@@ -372,7 +372,7 @@ static inline u64 xt_percpu_counter_alloc(void) · 371 unmodified lines
372372 if (res == NULL)
373373 return (u64) -ENOMEM;
374374
375− return (__force u64) res;
375+ return (u64) (__force unsigned long) res;
376376 }
377377
378378 return 0;
@@ -380,14 +380,14 @@ static inline u64 xt_percpu_counter_alloc(void) · 1 unmodified line
380380 static inline void xt_percpu_counter_free(u64 pcnt)
381381 {
382382 if (nr_cpu_ids > 1)
383− free_percpu((void __percpu *) pcnt);
383+ free_percpu((void __percpu *) (unsigned long) pcnt);
384384 }
385385
386386 static inline struct xt_counters *
387387 xt_get_this_cpu_counter(struct xt_counters *cnt)
388388 {
389389 if (nr_cpu_ids > 1)
390− return this_cpu_ptr((void __percpu *) cnt->pcnt);
390+ return this_cpu_ptr((void __percpu *) (unsigned long) cnt->pcnt);
391391
392392 return cnt;
393393 }
@@ -396,7 +396,7 @@ static inline struct xt_counters * · 2 unmodified lines
396396 xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu)
397397 {
398398 if (nr_cpu_ids > 1)
399− return per_cpu_ptr((void __percpu *) cnt->pcnt, cpu);
399+ return per_cpu_ptr((void __percpu *) (unsigned long) cnt->pcnt, cpu);
400400
401401 return cnt;
402402 }