[CRIU] [PATCH] fsnotify: Fix bad field name in list iterations

Pavel Emelyanov xemul at virtuozzo.com
Mon Jun 19 17:03:30 MSK 2017


Surprisingly, but

offsetof(inotify_wd_entry, node) == offsetof(fanotify_mark_entry, node)

even though both structures have node field in the middle and the
fields sitting above one are totally different.

So the code works, but ... we're risking :)

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/fsnotify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index e3d62e5..3c71bf3 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -468,7 +468,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
 		goto free;
 
 	i = 0;
-	list_for_each_entry(we, &wd_list.list, ify.node)
+	list_for_each_entry(we, &wd_list.list, ffy.node)
 		fe.mark[i++] = &we->ffy.e;
 	fe.n_mark = wd_list.n;
 
@@ -480,7 +480,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
 	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
 free:
 	xfree(fe.mark);
-	list_for_each_entry_safe(we, tmp, &wd_list.list, ify.node)
+	list_for_each_entry_safe(we, tmp, &wd_list.list, ffy.node)
 		free_fanotify_mark_entry(we);
 	return ret;
 }
-- 
2.1.4


More information about the CRIU mailing list