[CRIU] [PATCH 8/8] parasite: Make sure all argument structures are declared correctly

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 21 15:22:18 EST 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/parasite.h |    3 +++
 parasite.c         |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/parasite.h b/include/parasite.h
index adb708d..244954d 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -70,6 +70,9 @@ typedef struct  {
 		(st)->line	= __LINE__;		\
 	} while (0)
 
+#define BUILD_CHECK_PARASITE_ARG_TYPE(type)		\
+	BUILD_BUG_ON(offsetof(type, status) != 0)
+
 struct parasite_init_args {
 	parasite_status_t	status;
 
diff --git a/parasite.c b/parasite.c
index c8e47fa..f455e35 100644
--- a/parasite.c
+++ b/parasite.c
@@ -444,6 +444,10 @@ static int __used parasite_service(unsigned long cmd, void *args, void *brk)
 	BUILD_BUG_ON(sizeof(struct parasite_init_args) > PARASITE_ARG_SIZE);
 	BUILD_BUG_ON(sizeof(struct parasite_dump_misc) > PARASITE_ARG_SIZE);
 
+	BUILD_CHECK_PARASITE_ARG_TYPE(struct parasite_init_args);
+	BUILD_CHECK_PARASITE_ARG_TYPE(struct parasite_dump_pages_args);
+	BUILD_CHECK_PARASITE_ARG_TYPE(struct parasite_dump_misc);
+
 	switch (cmd) {
 	case PARASITE_CMD_PINGME:
 		return 0;
-- 
1.7.7.6



More information about the CRIU mailing list