diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-23 22:58:56 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-24 20:25:22 -0400 |
commit | 68bf8611076a8e4bee8bc8d03ff28bd1e9a9c631 (patch) | |
tree | 6d086c2b2872af7c88facadabf4fca75c2174682 | |
parent | 3d268c9b136f51385f9d041f3f2424501b257388 (diff) |
overlayfs: make ovl_cache_entry->name an array instead of pointer
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/overlayfs/readdir.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index b7d9fb098840..9c9872be2c72 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c @@ -18,13 +18,13 @@ #include "overlayfs.h" struct ovl_cache_entry { - const char *name; unsigned int len; unsigned int type; u64 ino; bool is_whiteout; struct list_head l_node; struct rb_node node; + char name[]; }; struct ovl_dir_cache { @@ -82,13 +82,12 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, u64 ino, unsigned int d_type) { struct ovl_cache_entry *p; + size_t size = offsetof(struct ovl_cache_entry, name[len + 1]); - p = kmalloc(sizeof(*p) + len + 1, GFP_KERNEL); + p = kmalloc(size, GFP_KERNEL); if (p) { - char *name_copy = (char *) (p + 1); - memcpy(name_copy, name, len); - name_copy[len] = '\0'; - p->name = name_copy; + memcpy(p->name, name, len); + p->name[len] = '\0'; p->len = len; p->type = d_type; p->ino = ino; |