Il mer 5 mar 2025, 16:39 Philippe Mathieu-Daudé <phi...@linaro.org> ha
scritto:

> +    for (size_t i = 0; i < ARRAY_SIZE(legacy_binary_infos); i++) {
> +        if (!strcmp(legacy_binary_infos[i].binary_name, binary_name)) {
> +            current_index = i;
> +            return;
> +        }
> +    }
> +    fprintf(stderr, "Missing legacy info for '%s' binary.\n",
> binary_name);
>

Wouldn't this crash if a binary is renamed to qemu-kvm or anything else but
its original name? There should be a default target in the binary, and this
function should only be called it there's none; but it should also use the
normal Error** interface instead of aborting.

Also do not call things legacy, as Pierrick also said and explained.

Paolo

+    abort();
> +}
> diff --git a/system/vl.c b/system/vl.c
> index a41ba4a2d5f..74a062c7fff 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -28,6 +28,7 @@
>  #include "qemu/units.h"
>  #include "qemu/module.h"
>  #include "qemu/arch_info.h"
> +#include "qemu/legacy_binary_info.h"
>  #include "exec/cpu-common.h"
>  #include "exec/page-vary.h"
>  #include "hw/qdev-properties.h"
> @@ -2883,6 +2884,7 @@ void qemu_init(int argc, char **argv)
>
>      error_init(argv[0]);
>      qemu_init_exec_dir(argv[0]);
> +    legacy_binary_info_init(argv[0]);
>
>      os_setup_limits();
>
> --
> 2.47.1
>
>

Reply via email to