[rtems commit] IMFS: Avoid NULL pointer access
Sebastian Huber
sebh at rtems.org
Wed Oct 8 09:17:50 UTC 2014
Module: rtems
Branch: master
Commit: 22cd2821de2dcec7117fa0370a495e675de206a4
Changeset: http://git.rtems.org/rtems/commit/?id=22cd2821de2dcec7117fa0370a495e675de206a4
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Oct 8 11:24:36 2014 +0200
IMFS: Avoid NULL pointer access
Avoid NULL pointer access in IMFS_is_imfs_instance(). File systems
mounted via mount() always have a valid type string.
---
cpukit/libcsupport/src/__usrenv.c | 3 ++-
testsuites/fstests/fsimfsgeneric01/init.c | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/cpukit/libcsupport/src/__usrenv.c b/cpukit/libcsupport/src/__usrenv.c
index 71efda9..d032aea 100644
--- a/cpukit/libcsupport/src/__usrenv.c
+++ b/cpukit/libcsupport/src/__usrenv.c
@@ -229,7 +229,8 @@ rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry = {
.mt_point_node = &rtems_filesystem_global_location_null,
.mt_fs_root = &rtems_filesystem_global_location_null,
.mounted = false,
- .writeable = false
+ .writeable = false,
+ .type = ""
};
rtems_filesystem_global_location_t rtems_filesystem_global_location_null = {
diff --git a/testsuites/fstests/fsimfsgeneric01/init.c b/testsuites/fstests/fsimfsgeneric01/init.c
index 09e7ed6..40f0aed 100644
--- a/testsuites/fstests/fsimfsgeneric01/init.c
+++ b/testsuites/fstests/fsimfsgeneric01/init.c
@@ -472,6 +472,17 @@ static void test_imfs_make_generic_node_errors(void)
rtems_test_assert(rv == -1);
rtems_test_assert(errno == EIO);
rtems_test_assert(rtems_resource_snapshot_check(&before));
+
+ errno = 0;
+ rv = IMFS_make_generic_node(
+ "/nil/nada",
+ S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
+ &node_control,
+ NULL
+ );
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOENT);
+ rtems_test_assert(rtems_resource_snapshot_check(&before));
}
static void Init(rtems_task_argument arg)
More information about the vc
mailing list