Skip to contentSkip to conversation

io_control01: Initialise the io_stats start structure

PATCH In review Ashwin Dayanand Kamat via ltp 2 participants 2 messages Mar 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_control01: Initialise the io_stats start structure

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 <[email protected]>

---
 testcases/kernel/controllers/io/io_control01.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/controllers/io/io_control01.c +1 -0
index c4e171af5..691196886 100644
@@ -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) {
Signature · 5 lines
2.39.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp