diff options
| author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2014-05-30 11:35:54 -0600 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:58:32 +0200 |
| commit | 12ce625e761647cacc2853fdc42b2b8b65ed6175 (patch) | |
| tree | 74ad8239e93e74d3da0bd07f0f726304a5282c1d | |
| parent | bf7cbf18fba993ab2727e180336baf80587a2788 (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>
| -rw-r--r-- | include/linux/vfio.h | 5 |
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 */ |
