[PATCH 02/14] Fix size calculation of ngnfs_dirent in init_dirent_args()
Valerie Aurora
val at versity.com
Thu Feb 27 06:16:11 PST 2025
init_dirent_args() was calculating slightly too large of a size for
the ngnfs_dirent struct, adding name_len to the total size of the
dirent struct (which includes 6 bytes of the name) rather than to the
offset of the beginning of the name buffer in the struct.
Signed-off-by: Valerie Aurora <val at versity.com>
---
shared/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shared/dir.c b/shared/dir.c
index 6337463..6375f65 100644
--- a/shared/dir.c
+++ b/shared/dir.c
@@ -77,7 +77,7 @@ static void init_dirent_args(struct dirent_args *da, char *name, size_t name_len
mode_t mode)
{
da->hash = name_hash(name, name_len);
- da->dent_size = sizeof(struct ngnfs_dirent) + name_len;
+ da->dent_size = offsetof(struct ngnfs_dirent, name) + name_len;
da->mode = mode;
da->dent.ino = cpu_to_le64(ino);
--
2.48.1
More information about the ngnfs-devel
mailing list