[LTP] [PATCH v3] read_all :catch alignment faults while reading sys entries seen in commit :1bbc21785b7336619fb6a67f1fff5afdaf229acc

Subramanya Swamy subramanya.swamy.linux@gmail.com
Mon Jan 15 14:34:00 CET 2024


Signed-off-by: Subramanya Swamy <subramanya.swamy.linux@gmail.com>
---
 testcases/kernel/fs/read_all/read_all.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index ddc48edd8..e87f47979 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -251,17 +251,11 @@ static void read_test(const int worker, const char *const path)
 	worker_heartbeat(worker);
 	/*
 	 * This could catch any alignment faults while reading sys entries
-	 * seen in commit :1bbc21785b7336619fb6a67f1fff5afdaf229acc so reading 1024 bytes
-	 * in chunks of 8 bytes 128 times
+	 * seen in commit :1bbc21785b7336619fb6a67f1fff5afdaf229acc
 	 */
 	char check_buf[7];
-	unsigned int i;
 
-	for (i = 0; i < 128; i++) {
-		count = read(fd, check_buf, sizeof(check_buf));
-		if (count == 0 || count < 0)
-			break;
-	}
+	count = pread(fd, check_buf, sizeof(check_buf), 1);
 
 	count = pread(fd, buf, sizeof(buf) - 1, 0);
 	elapsed = worker_elapsed(worker);
-- 
2.39.3



More information about the ltp mailing list