linux-user/i386: Return const data from get_elf_platform

Rather than modify a static buffer, index into an array of const data.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2025-08-28 06:39:25 +10:00
parent 3c907dec45
commit e03b6ad483
+4 -8
View File
@@ -17,13 +17,9 @@ abi_ulong get_elf_hwcap(CPUState *cs)
const char *get_elf_platform(CPUState *cs)
{
static char elf_platform[] = "i386";
static const char elf_platform[4][5] = { "i386", "i486", "i586", "i686" };
int family = object_property_get_int(OBJECT(cs), "family", NULL);
if (family > 6) {
family = 6;
}
if (family >= 3) {
elf_platform[1] = '0' + family;
}
return elf_platform;
family = MAX(MIN(family, 6), 3);
return elf_platform[family - 3];
}