Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b13460b9 authored by Gavin Shan's avatar Gavin Shan Committed by Alex Williamson
Browse files

drivers/vfio: Rework offsetofend()



The macro offsetofend() introduces unnecessary temporary variable
"tmp". The patch avoids that and saves a bit memory in stack.

Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent c8dbca16
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -86,9 +86,8 @@ 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))

/*
 * External user API