[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/30] intc/exynos4210_gic: replace snprintf() with g_strdup_print
From: |
marcandre . lureau |
Subject: |
[PULL 10/30] intc/exynos4210_gic: replace snprintf() with g_strdup_printf() |
Date: |
Thu, 21 Apr 2022 17:49:20 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
While at it, replace '%x' with '%u' as suggested by Philippe Mathieu-Daudé.
Also fixes a GCC 12.0.1 -Wformat-overflow false-positive.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-16-marcandre.lureau@redhat.com>
---
hw/intc/exynos4210_gic.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
index bc73d1f11524..f8dd719caa1e 100644
--- a/hw/intc/exynos4210_gic.c
+++ b/hw/intc/exynos4210_gic.c
@@ -289,10 +289,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error
**errp)
Object *obj = OBJECT(dev);
Exynos4210GicState *s = EXYNOS4210_GIC(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
- const char cpu_prefix[] = "exynos4210-gic-alias_cpu";
- const char dist_prefix[] = "exynos4210-gic-alias_dist";
- char cpu_alias_name[sizeof(cpu_prefix) + 3];
- char dist_alias_name[sizeof(cpu_prefix) + 3];
SysBusDevice *gicbusdev;
uint32_t n = s->num_cpu;
uint32_t i;
@@ -322,8 +318,10 @@ static void exynos4210_gic_realize(DeviceState *dev, Error
**errp)
*/
assert(n <= EXYNOS4210_NCPUS);
for (i = 0; i < n; i++) {
+ g_autofree char *cpu_alias_name =
g_strdup_printf("exynos4210-gic-alias_cpu%u", i);
+ g_autofree char *dist_alias_name =
g_strdup_printf("exynos4210-gic-alias_dist%u", i);
+
/* Map CPU interface per SMP Core */
- sprintf(cpu_alias_name, "%s%x", cpu_prefix, i);
memory_region_init_alias(&s->cpu_alias[i], obj,
cpu_alias_name,
sysbus_mmio_get_region(gicbusdev, 1),
@@ -333,7 +331,6 @@ static void exynos4210_gic_realize(DeviceState *dev, Error
**errp)
EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]);
/* Map Distributor per SMP Core */
- sprintf(dist_alias_name, "%s%x", dist_prefix, i);
memory_region_init_alias(&s->dist_alias[i], obj,
dist_alias_name,
sysbus_mmio_get_region(gicbusdev, 0),
--
2.36.0
- [PULL 00/30] Misc patches, marcandre . lureau, 2022/04/21
- [PULL 01/30] glib-compat: isolate g_date_time_format_iso8601 version-bypass, marcandre . lureau, 2022/04/21
- [PULL 02/30] scripts/analyze-inclusions: drop qemu-common.h from analysis, marcandre . lureau, 2022/04/21
- [PULL 03/30] Simplify softmmu/main.c, marcandre . lureau, 2022/04/21
- [PULL 05/30] include: rename qemu-common.h qemu/help-texts.h, marcandre . lureau, 2022/04/21
- [PULL 04/30] hw/hyperv: remove needless qemu-common.h include, marcandre . lureau, 2022/04/21
- [PULL 06/30] qga: replace usleep() with g_usleep(), marcandre . lureau, 2022/04/21
- [PULL 08/30] arm/digic: replace snprintf() with g_strdup_printf(), marcandre . lureau, 2022/04/21
- [PULL 07/30] docs: trace-events-all is installed without renaming, marcandre . lureau, 2022/04/21
- [PULL 09/30] arm/allwinner-a10: replace snprintf() with g_strdup_printf(), marcandre . lureau, 2022/04/21
- [PULL 10/30] intc/exynos4210_gic: replace snprintf() with g_strdup_printf(),
marcandre . lureau <=
- [PULL 11/30] doc/style: CLang -> Clang, marcandre . lureau, 2022/04/21
- [PULL 12/30] osdep.h: move qemu_build_not_reached(), marcandre . lureau, 2022/04/21
- [PULL 13/30] compiler.h: replace QEMU_NORETURN with G_NORETURN, marcandre . lureau, 2022/04/21
- [PULL 14/30] include: move qemu_msync() to osdep, marcandre . lureau, 2022/04/21
- [PULL 15/30] include: move qemu_fdatasync() to osdep, marcandre . lureau, 2022/04/21
- [PULL 16/30] include: add qemu/keyval.h, marcandre . lureau, 2022/04/21
- [PULL 17/30] include: move qdict_{crumple,flatten} declarations, marcandre . lureau, 2022/04/21
- [PULL 19/30] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}, marcandre . lureau, 2022/04/21
- [PULL 18/30] tests: remove block/qdict checks from check-qobject.c, marcandre . lureau, 2022/04/21
- [PULL 20/30] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/21