[LTP] [PATCH v1 2/2] fsx-linux: Fix op_max_size handling in op_file_position()
Jinseok Kim
always.starving0@gmail.com
Mon Aug 17 17:40:45 CEST 2026
op_file_position() ignored op_max_size (-o option), causing operation
sizes to span up to the entire file size. Cap max_len with op_max_size
to honor the user option.
Signed-off-by: Jinseok Kim <always.starving0@gmail.com>
---
testcases/kernel/fs/fsx-linux/fsx-linux.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/fs/fsx-linux/fsx-linux.c b/testcases/kernel/fs/fsx-linux/fsx-linux.c
index 21390c58c..81aca5dab 100644
--- a/testcases/kernel/fs/fsx-linux/fsx-linux.c
+++ b/testcases/kernel/fs/fsx-linux/fsx-linux.c
@@ -77,9 +77,15 @@ static void op_file_position(
struct file_pos_t *pos)
{
long long diff;
+ long long max_len;
pos->offset = random() % fsize;
- pos->size = random() % (fsize - pos->offset);
+
+ max_len = fsize - pos->offset;
+ if (max_len > op_max_size)
+ max_len = op_max_size;
+
+ pos->size = random() % max_len;
diff = pos->offset % align;
--
2.43.0
More information about the ltp
mailing list