aboutsummaryrefslogtreecommitdiff
path: root/include/linux/vfio.h
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2014-05-30 11:35:54 -0600
committerMister Oyster <oysterized@gmail.com>2017-04-11 10:58:32 +0200
commit12ce625e761647cacc2853fdc42b2b8b65ed6175 (patch)
tree74ad8239e93e74d3da0bd07f0f726304a5282c1d /include/linux/vfio.h
parentbf7cbf18fba993ab2727e180336baf80587a2788 (diff)
drivers/vfio: Rework offsetofend()
commit b13460b92093b29347e99d6c3242e350052b62cd upstream. The macro offsetofend() introduces unnecessary temporary variable "tmp". The patch avoids that and saves a bit memory in stack. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> [wt: backported only for ipv6 out-of-bounds fix] Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'include/linux/vfio.h')
-rw-r--r--include/linux/vfio.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ac8d488e4..1a7f0acf8 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -86,8 +86,7 @@ extern void vfio_unregister_iommu_driver(
* from user space. This allows us to easily determine if the provided
* structure is sized to include various fields.
*/
-#define offsetofend(TYPE, MEMBER) ({ \
- TYPE tmp; \
- offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
+#define offsetofend(TYPE, MEMBER) \
+ (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
#endif /* VFIO_H */