[PATCH] include: Use char* for arithmetic over void*

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

 



Replaces use of (void *) for pointer arithmetic in three inline
functions and two macros within the iptables includes.

---
 include/linux/netfilter/x_tables.h        | 4 ++--
 include/linux/netfilter_arp/arp_tables.h  | 2 +-
 include/linux/netfilter_ipv4/ip_tables.h  | 2 +-
 include/linux/netfilter_ipv6/ip6_tables.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 41209700..4f9f872a 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -133,7 +133,7 @@ struct xt_counters_info {
 	for (__i = sizeof(type);				\
 	     __i < (e)->target_offset;				\
 	     __i += __m->u.match_size) {			\
-		__m = (void *)e + __i;				\
+		__m = (struct xt_entry_match*)((char *)e + __i);\
 								\
 		__ret = fn(__m , ## args);			\
 		if (__ret != 0)					\
@@ -151,7 +151,7 @@ struct xt_counters_info {
 								\
 	for (__i = 0, __n = 0; __i < (size);			\
 	     __i += __entry->next_offset, __n++) { 		\
-		__entry = (void *)(entries) + __i;		\
+		__entry = (type *)((char *)(entries) + __i);	\
 		if (__n < n)					\
 			continue;				\
 								\
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index bb1ec648..f02498e2 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -195,7 +195,7 @@ struct arpt_get_entries {
 /* Helper functions */
 static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
 {
-	return (void *)e + e->target_offset;
+	return (struct xt_entry_target *)((char *)e + e->target_offset);
 }

 /*
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 38542b4f..2ec062cc 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -218,7 +218,7 @@ struct ipt_get_entries {
 static __inline__ struct xt_entry_target *
 ipt_get_target(struct ipt_entry *e)
 {
-	return (void *)e + e->target_offset;
+	return (struct xt_entry_target *)((char *)e + e->target_offset);
 }

 /*
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 640a1d09..d11add40 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -258,7 +258,7 @@ struct ip6t_get_entries {
 static __inline__ struct xt_entry_target *
 ip6t_get_target(struct ip6t_entry *e)
 {
-	return (void *)e + e->target_offset;
+	return (struct xt_entry_target *)((char *)e + e->target_offset);
 }

 /*
--
2.20.1

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux