target/arm: Replace sprintf() by snprintf()

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use snprintf() instead.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240411104340.6617-9-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-04-11 12:31:44 +02:00
parent c76b288d78
commit 2ad9d04492

View File

@ -437,7 +437,7 @@ void aarch64_add_sve_properties(Object *obj)
for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { for (vq = 1; vq <= ARM_MAX_VQ; ++vq) {
char name[8]; char name[8];
sprintf(name, "sve%d", vq * 128); snprintf(name, sizeof(name), "sve%d", vq * 128);
object_property_add(obj, name, "bool", cpu_arm_get_vq, object_property_add(obj, name, "bool", cpu_arm_get_vq,
cpu_arm_set_vq, NULL, &cpu->sve_vq); cpu_arm_set_vq, NULL, &cpu->sve_vq);
} }
@ -462,7 +462,7 @@ void aarch64_add_sme_properties(Object *obj)
for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) { for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) {
char name[8]; char name[8];
sprintf(name, "sme%d", vq * 128); snprintf(name, sizeof(name), "sme%d", vq * 128);
object_property_add(obj, name, "bool", cpu_arm_get_vq, object_property_add(obj, name, "bool", cpu_arm_get_vq,
cpu_arm_set_vq, NULL, &cpu->sme_vq); cpu_arm_set_vq, NULL, &cpu->sme_vq);
} }