Clarify the definition of endof() by using the offsetof() and sizeof() macros to handle the pointer magic.
Signed-off-by: Jesse Larrew <jlar...@linux.vnet.ibm.com> --- hw/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 8f521b3..663f33c 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -81,7 +81,7 @@ typedef struct VirtIONet * 'container'. */ #define endof(container, field) \ - ((intptr_t)(&(((container *)0)->field)+1)) + (offsetof(container, field) + sizeof(((container *)0)->field)) typedef struct VirtIOFeature { uint32_t flags; -- 1.7.11.7