verify: fix integer sizes in verify state file
authorVincent Fu <vincent.fu@samsung.com>
Fri, 16 Feb 2024 01:33:21 +0000 (01:33 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Fri, 16 Feb 2024 14:25:35 +0000 (09:25 -0500)
nofiles and depth are 32-bit integers. So we shouldn't use 64-bit
conversion functions and casts. The current code actually works fine on
little-endian platforms since the conversion is a noop but this is
broken on big-endian platforms.

Fixes: 94a6e1bb ("Fix verify state for multiple files")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
verify.c

index b438eed6bd3d8af954b754a55fb57c054b79e7f2..b2fede24710fd3fcedfbcda890b3b9def9a957be 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -1619,8 +1619,8 @@ struct all_io_list *get_all_io_list(int save_mask, size_t *sz)
                comps = fill_file_completions(td, s, &index);
 
                s->no_comps = cpu_to_le64((uint64_t) comps);
-               s->depth = cpu_to_le64((uint64_t) td->o.iodepth);
-               s->nofiles = cpu_to_le64((uint64_t) td->o.nr_files);
+               s->depth = cpu_to_le32((uint32_t) td->o.iodepth);
+               s->nofiles = cpu_to_le32((uint32_t) td->o.nr_files);
                s->numberio = cpu_to_le64((uint64_t) td->io_issues[DDIR_WRITE]);
                s->index = cpu_to_le64((uint64_t) __td_index);
                if (td->random_state.use64) {