[PATCH] testsuites/fstests: Fix uninitialized utimbuf structs
Alex White
alex.white at oarcorp.com
Tue Sep 7 03:47:08 UTC 2021
The utimbuf structs in fsimfsconfig01 and fsimfsconfig02 were
being passed to utime uninitialized. This did not cause problems until
utime was changed to use utimensat behind the scenes. Now that
utimensat is called, the values of the utimbuf struct are checked, and
EINVAL is set for invalid values. The utimebuf structs in these tests
could contain invalid values since they are uninitialized.
By zero-initializing the utimbuf structs, we ensure that they pass the
checks in utimensat and that errno is set to the expected ENOTSUP.
---
testsuites/fstests/fsimfsconfig01/init.c | 2 +-
testsuites/fstests/fsimfsconfig03/init.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/testsuites/fstests/fsimfsconfig01/init.c b/testsuites/fstests/fsimfsconfig01/init.c
index fd11329bf6..e9e811a5f1 100644
--- a/testsuites/fstests/fsimfsconfig01/init.c
+++ b/testsuites/fstests/fsimfsconfig01/init.c
@@ -39,7 +39,7 @@ static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
static void Init(rtems_task_argument arg)
{
- struct utimbuf times;
+ struct utimbuf times = {0};
const char *generic = "generic";
const char *mnt = "mnt";
const char *dev = "device";
diff --git a/testsuites/fstests/fsimfsconfig03/init.c b/testsuites/fstests/fsimfsconfig03/init.c
index 32db1638f4..3fdaa5f85b 100644
--- a/testsuites/fstests/fsimfsconfig03/init.c
+++ b/testsuites/fstests/fsimfsconfig03/init.c
@@ -38,7 +38,7 @@ static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
static void Init(rtems_task_argument arg)
{
- struct utimbuf times;
+ struct utimbuf times = {0};
const char *generic = "generic";
const char *mnt = "mnt";
const char *dev = "device";
--
2.27.0
More information about the devel
mailing list