net/mlx5e: Avoid unbounded peer devices when unpairing TC hairpin rules
[sfrench/cifs-2.6.git] / include / linux / stddef.h
index 2181719fd907b6cc516f0c02217d0a32d2b7874c..998a4ba28eba40c966f7e4a6aaa68f46f6b3466b 100644 (file)
@@ -19,6 +19,14 @@ enum {
 #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
 #endif
 
+/**
+ * sizeof_field(TYPE, MEMBER)
+ *
+ * @TYPE: The structure containing the field of interest
+ * @MEMBER: The field to return the size of
+ */
+#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
+
 /**
  * offsetofend(TYPE, MEMBER)
  *
@@ -26,6 +34,6 @@ enum {
  * @MEMBER: The member within the structure to get the end offset of
  */
 #define offsetofend(TYPE, MEMBER) \
-       (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
+       (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
 
 #endif