Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[maintenance] blkgetsize64: avoid warning about uninit value
Analyzer can't figure out that 'rc' is set on 'fd < 0',
and we never try to use 'size_in_bytes'.

Appears to be a limitation in the analyzer, it doesn't realize that `fd < 0` implies that `rc` is set to `NOT_IMPLEMENTED`,
which raises an exception, so `caml_copy_int64` is never reached.

But the logic there is quite hard to follow, so better be explicit, and ensure `size_in_bytes` is always initialized.

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Mar 4, 2025
commit 23e01d767eca2a3ac0037300564146d5ca9000d4
3 changes: 2 additions & 1 deletion ocaml/libs/vhd/vhd_format_lwt/blkgetsize64_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ CAMLprim value stub_blkgetsize64(value filename){
}
#endif
close(fd);
}
} else
size_in_bytes = -1;
caml_leave_blocking_section();
free((void*)filename_c);

Expand Down
Loading