summaryrefslogtreecommitdiff
path: root/cpukit
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2023-10-04 21:41:37 -0500
committerJoel Sherrill <joel@rtems.org>2023-10-12 18:56:43 -0500
commit0a1d0dce3b2f84f7992828f3435ee3f292e79ad9 (patch)
tree11b83c8e89430d38e0f801c15f55f3a839027bba /cpukit
parentd7aa1ab86fc06799286eb5a648eeb488446c4bbc (diff)
cpukit/jffs2: Correctly init jffs2_inode_info
The repeated reinitialization of jffs2_inode_info must be done by the members of the struct to avoid altering others.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libfs/src/jffs2/src/fs-rtems.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 0d97e7a6fb..8e8dfe8b0c 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -1523,6 +1523,8 @@ static struct _inode *new_inode(struct super_block *sb)
inode->i_cache_next = NULL; // Newest inode, about to be cached
+ mutex_init(&JFFS2_INODE_INFO(inode)->sem)
+
// Add to the icache
for (cached_inode = sb->s_root; cached_inode != NULL;
cached_inode = cached_inode->i_cache_next) {
@@ -1639,8 +1641,14 @@ void jffs2_iput(struct _inode *i)
static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
{
- memset(f, 0, sizeof(*f));
- mutex_init(&f->sem);
+ /* These must be set manually to preserve other members */
+ f->highest_version = 0;
+ f->fragtree = RB_ROOT;
+ f->metadata = NULL;
+ f->dents = NULL;
+ f->target = NULL;
+ f->flags = 0;
+ f->usercompr = 0;
}
static void jffs2_clear_inode (struct _inode *inode)