[rtems commit] cpukit/jffs2: Avoid possible null deref
Joel Sherrill
joel at rtems.org
Thu Mar 23 15:16:07 UTC 2023
Module: rtems
Branch: master
Commit: acf4eb271c3a9f60a8d00cdf13b821036d39536c
Changeset: http://git.rtems.org/rtems/commit/?id=acf4eb271c3a9f60a8d00cdf13b821036d39536c
Author: Kinsey Moore <kinsey.moore at oarcorp.com>
Date: Wed Mar 22 16:17:08 2023 -0500
cpukit/jffs2: Avoid possible null deref
This was added with the writebuffer work and should have been protected
by the error check.
---
cpukit/libfs/src/jffs2/src/fs-rtems.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index bff7d59ba1..9a0f4cb6f8 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -1365,11 +1365,11 @@ int rtems_jffs2_initialize(
err = -ENOMEM;
}
- sb = &fs_info->sb;
- c = JFFS2_SB_INFO(sb);
- c->mtd = NULL;
if (err == 0) {
+ sb = &fs_info->sb;
+ c = JFFS2_SB_INFO(sb);
+ c->mtd = NULL;
rtems_recursive_mutex_init(&sb->s_mutex, RTEMS_FILESYSTEM_TYPE_JFFS2);
}
More information about the vc
mailing list