All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Overlayfs: ovl_fill_merge() should use container_of() rather than direct cast
@ 2014-10-30 14:10 David Howells
  2014-10-30 14:36 ` Miklos Szeredi
  0 siblings, 1 reply; 7+ messages in thread
From: David Howells @ 2014-10-30 14:10 UTC (permalink / raw)
  To: viro, miklos; +Cc: dhowells, linux-fsdevel, linux-unionfs, linux-kernel

ovl_fill_merge() effectively directly casts the buf pointer to an
ovl_readdir_data struct pointer, but the pointer actually points to the
dir_context struct contained therein.

So use container_of() instead.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/overlayfs/readdir.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 910553f37aca..d142c2bf8f1e 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -181,7 +181,9 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry)
 static int ovl_fill_merge(void *buf, const char *name, int namelen,
 			  loff_t offset, u64 ino, unsigned int d_type)
 {
-	struct ovl_readdir_data *rdd = buf;
+	struct dir_context *ctx = buf;
+	struct ovl_readdir_data *rdd =
+		container_of(ctx, struct ovl_readdir_data, ctx);
 
 	rdd->count++;
 	if (!rdd->is_merge)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-31 10:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 14:10 [PATCH] Overlayfs: ovl_fill_merge() should use container_of() rather than direct cast David Howells
2014-10-30 14:36 ` Miklos Szeredi
2014-10-30 14:47   ` David Howells
2014-10-30 16:37     ` Miklos Szeredi
2014-10-31  9:46       ` [PATCH fixed] vfs: make first argument of dir_context.actor typed Miklos Szeredi
2014-10-31 10:28         ` Al Viro
2014-10-31 10:18       ` [PATCH] Overlayfs: ovl_fill_merge() should use container_of() rather than direct cast David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.