[LTP] [PATCH] io_control01: Initialise the io_stats start structure

Ashwin Dayanand Kamat kashwindayan@vmware.com
Thu Mar 30 07:23:48 CEST 2023


struct io_stats start structure is a locally declared structure
which when not initialised can be filled with junk values in some platforms
like arm. These values are later compared and hence it leads to failure on
photon arm platform. Fix is to memset the structure.

Signed-off by: Ashwin Dayanand Kamat <kashwindayan@vmware.com>
---
 testcases/kernel/controllers/io/io_control01.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/kernel/controllers/io/io_control01.c b/testcases/kernel/controllers/io/io_control01.c
index c4e171af5..691196886 100644
--- a/testcases/kernel/controllers/io/io_control01.c
+++ b/testcases/kernel/controllers/io/io_control01.c
@@ -55,6 +55,7 @@ static void run(void)
 	char *buf = SAFE_MALLOC(MAX((size_t)BUFSIZ, pgsz));
 	struct io_stats start;
 
+	memset(&start, 0, sizeof(struct io_stats));
 	SAFE_CG_READ(tst_cg, "io.stat", buf, BUFSIZ - 1);
 	line = strtok_r(buf, "\n", &buf_ptr);
 	while (line) {
-- 
2.39.0



More information about the ltp mailing list