From aaea18d5d697d94ba63122a644690b9a9e7db007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 20 Apr 2022 17:25:57 +0400 Subject: [PATCH] arm/allwinner-a10: replace snprintf() with g_strdup_printf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fixes a GCC 12.0.1 false-positive: ../hw/arm/allwinner-a10.c: In function ‘aw_a10_realize’: ../hw/arm/allwinner-a10.c:135:35: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 8 [-Werror=format-overflow=] 135 | sprintf(bus, "usb-bus.%d", i); | ^~ Signed-off-by: Marc-André Lureau Reviewed-by: Peter Maydell Reviewed-by: Daniel P. Berrangé Message-Id: <20220420132624.2439741-15-marcandre.lureau@redhat.com> --- hw/arm/allwinner-a10.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 05e84728cb..79082289ea 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -130,9 +130,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp) int i; for (i = 0; i < AW_A10_NUM_USB; i++) { - char bus[16]; - - sprintf(bus, "usb-bus.%d", i); + g_autofree char *bus = g_strdup_printf("usb-bus.%d", i); object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable", true, &error_fatal);