* tmpfs/dir.c (diskfs_direnter_hard): Fix malloc size.

---
Hello,

Found this little doozy while examining Sergio's patches.  ENTSIZE was
changed back in 2f7f90ce to reflect the size of a struct dirent instead
of a tmpfs_dirent, but NEW is still a tmpfs_dirent...  I just snatched
the old code prior to 2f7f90ce.

It compiles but I'm too lazy to tested it ATM (what with applying patches
and all).  That isn't really necessary in this case, is it?

Regards,
  Fredrik
---
 tmpfs/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tmpfs/dir.c b/tmpfs/dir.c
index 25b99bd..2702da5 100644
--- a/tmpfs/dir.c
+++ b/tmpfs/dir.c
@@ -247,7 +247,7 @@ diskfs_direnter_hard (struct node *dp, const char *name,
       > tmpfs_page_limit)
     return ENOSPC;
 
-  new = malloc (entsize);
+  new = malloc (offsetof (struct tmpfs_dirent, name) + namelen + 1);
   if (new == 0)
     return ENOSPC;
 
-- 
tg: (5923172..) t/tmpfs-fix-dir-malloc (depends on: master)

Reply via email to