Philippe Mathieu-Daudé <[email protected]> writes:

> Replace sprintf() by safer g_strdup_printf() to format the
> node name, silencing -Wdeprecated-declarations produced
> by Apple clang 17.0.0.
>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  hw/ppc/spapr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 54e3cc3cbe42..6f1a046a425d 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -352,14 +352,13 @@ static void add_str(GString *s, const gchar *s1)
>  static int spapr_dt_memory_node(SpaprMachineState *spapr, void *fdt, int 
> nodeid,
>                                  hwaddr start, hwaddr size)
>  {
> -    char mem_name[32];
> +    g_autofree char *mem_name = g_strdup_printf("memory@%" HWADDR_PRIx, 
> start);
>      uint64_t mem_reg_property[2];
>      int off;
>  
>      mem_reg_property[0] = cpu_to_be64(start);
>      mem_reg_property[1] = cpu_to_be64(size);
>  
> -    sprintf(mem_name, "memory@%" HWADDR_PRIx, start);

Reviewed-by: Alex Bennée <[email protected]>

>      off = fdt_add_subnode(fdt, 0, mem_name);

fun fact, ppc seems to be one of the arches that mixes fdt_add_subnode
with qemu_fdt_add_subnode.

>      _FDT(off);
>      _FDT((fdt_setprop_string(fdt, off, "device_type", "memory")));

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to