inotify: use container_of instead of casting
authorEric Paris <eparis@redhat.com>
Fri, 18 Dec 2009 01:12:06 +0000 (20:12 -0500)
committerEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 13:58:19 +0000 (09:58 -0400)
inotify_free_mark casts directly from an fsnotify_mark_entry to an
inotify_inode_mark_entry.  This works, but should use container_of instead
for future proofing.

Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/inotify/inotify_user.c

index f22a04005db21145add6647352ff6b3e3848078b..a0e40f7c9781ce61534d2e251a830f8d29f34045 100644 (file)
@@ -550,7 +550,9 @@ skip_send_ignore:
 /* ding dong the mark is dead */
 static void inotify_free_mark(struct fsnotify_mark_entry *entry)
 {
-       struct inotify_inode_mark_entry *ientry = (struct inotify_inode_mark_entry *)entry;
+       struct inotify_inode_mark_entry *ientry;
+
+       ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry);
 
        kmem_cache_free(inotify_inode_mark_cachep, ientry);
 }