[LTP] [PATCH 2/8] ftest: Fix uninitialized var error

Richard Palethorpe rpalethorpe@suse.com
Tue Jun 22 13:35:08 CEST 2021


Mark misc_intvl as const which allows the compiler to eliminate some
confusing branches. This is a minimal change to fix the error.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 testcases/kernel/fs/ftest/ftest01.c | 3 +--
 testcases/kernel/fs/ftest/ftest05.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/fs/ftest/ftest01.c b/testcases/kernel/fs/ftest/ftest01.c
index afad18095..31203d689 100644
--- a/testcases/kernel/fs/ftest/ftest01.c
+++ b/testcases/kernel/fs/ftest/ftest01.c
@@ -83,7 +83,7 @@ static void term(int sig);
 static int csize;		/* chunk size */
 static int iterations;		/* # total iterations */
 static int max_size;		/* max file size */
-static int misc_intvl;		/* for doing misc things; 0 ==> no */
+static const int misc_intvl = 10;		/* for doing misc things; 0 ==> no */
 static int nchild;		/* how many children */
 static int fd;			/* file descriptor used by child */
 static int parent_pid;
@@ -139,7 +139,6 @@ static void setup(void)
 	nchild = 5;
 	csize = K_2;		/* should run with 1, 2, and 4 K sizes */
 	max_size = K_1 * K_1;
-	misc_intvl = 10;
 
 	if (sigset(SIGTERM, term) == SIG_ERR) {
 		tst_brkm(TBROK | TERRNO, NULL, "sigset failed");
diff --git a/testcases/kernel/fs/ftest/ftest05.c b/testcases/kernel/fs/ftest/ftest05.c
index 0bd32e4f6..8d8e6d497 100644
--- a/testcases/kernel/fs/ftest/ftest05.c
+++ b/testcases/kernel/fs/ftest/ftest05.c
@@ -87,7 +87,7 @@ static void cleanup(void);
 static int csize;		/* chunk size */
 static int iterations;		/* # total iterations */
 static off64_t max_size;	/* max file size */
-static int misc_intvl;		/* for doing misc things; 0 ==> no */
+static const int misc_intvl = 10;		/* for doing misc things; 0 ==> no */
 static int nchild;		/* how many children */
 static int fd;			/* file descriptor used by child */
 static int parent_pid;
@@ -147,7 +147,6 @@ static void setup(void)
 	nchild = 5;
 	csize = K_2;		/* should run with 1, 2, and 4 K sizes */
 	max_size = K_1 * K_1;
-	misc_intvl = 10;
 
 	if (sigset(SIGTERM, term) == SIG_ERR) {
 		tst_brkm(TBROK | TERRNO, NULL,
-- 
2.31.1



More information about the ltp mailing list