@samitouri / QOSamiQemu / commits / b64a5f5351

tests/qtest/arm-cpu-features: Fix thinko in g_strdup_printf() call

In commit 62272f9f8891 we changed some uses of fixed char arrays to call g_strdup_printf() instead. In one place I made a silly error where in changing sprintf(name, "fmt string", ...) to name = g_strdup_printf("fmt string", ...) I forgot to delete "name" from the argument list. Luckily Coverity spotted this (as CID 1645771) because at this point "name" is NULL and passing g_strdup_printf() a NULL first argument is not valid. We didn't notice the mistake in testing or CI because this bit of code is only run if on an AArch64 host with KVM and SVE available. Correct the error by removing the stray function argument. Fixes: 62272f9f8891 ("tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char arrays") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@redhat.com> Message-id: 20260317111121.2062455-1-peter.maydell@linaro.org

Peter Maydell committed Mar 23, 2026 at 09:51 UTC b64a5f5351314a21b2f2b753a90f492d144e3b8b
1 file changed +1 -1
tests/qtest/arm-cpu-features.c
+1 -1
@@ -612,7 +612,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
612 * we need at least one vector length enabled.
613 */
614 vq = __builtin_ffsll(vls);
615 - name = g_strdup_printf(name, "sve%u", vq * 128);
615 + name = g_strdup_printf("sve%u", vq * 128);
616 error = g_strdup_printf("cannot disable %s", name);
617 assert_error(qts, "host", error, "{ %s: false }", name);
618 g_free(error);