Skip to contentSkip to conversation

Use offsetof() instead of own equivalent

PATCH New Pavel Roskin 1 participant 1 message Feb 19, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use offsetof() instead of own equivalent

The original macros result in gcc 4.2 warning about "cast from pointer to integer of different size" on 64-bit systems.

Use of offsetof() on fields in substructures is widespread throughout the kernel code and should work whether offsetof() is defined using __compiler_offsetof() or a cast.

---

 drivers/net/wireless/hostap/hostap_common.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/hostap/hostap_common.h +2 -2
index 0162400..b31e6a0 100644
@@ -368,9 +368,9 @@ enum {
 
 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024
 #define PRISM2_HOSTAPD_RID_HDR_LEN \
-((int) (&((struct prism2_hostapd_param *) 0)->u.rid.data))
+offsetof(struct prism2_hostapd_param, u.rid.data)
 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
-((int) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data))
+offsetof(struct prism2_hostapd_param, u.generic_elem.data)
 
 /* Maximum length for algorithm names (-1 for nul termination) used in ioctl()
  */