run.c: Fix uninitialized field

The `fd` field in the `Transformer` structure is not initialized.
Because of that, on certain code paths, calls to the system functions
will use a wrong file descriptor. This causes an assertion failure in
Unikraft.

Workaround for this was the commenting out of the
`CONFIG_LIBUKDEBUG_ENABLE_ASSERT` configuration option in Unikraft.

Fix this by initializing `fd` to -1. This makes the current code fully
functional on Unikraft, eliminating the assertion failure.

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
This commit is contained in:
Razvan Deaconescu 2023-10-08 17:40:25 +03:00
parent b27fe440fd
commit 0fb2db65cb

1
run.c
View File

@ -279,6 +279,7 @@ void read_checkpoint(char* checkpoint, Config* config, TransformerWeights* weigh
// memory map the Transformer weights
*data = (float*)(checkpoint + sizeof(Config));
float* weights_ptr = *data;
*fd = -1;
memory_map_weights(weights, config, weights_ptr, shared_weights);
}
#else