qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>, marcandre.lureau@redhat.com
Cc: Thomas Huth <thuth@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Igor Mitsyanko <i.mitsyanko@gmail.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Beniamino Galvani <b.galvani@gmail.com>,
	qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
	Antony Pavlov <antonynpavlov@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH 4/5] intc/exynos4210_gic: fix format-overflow warning
Date: Tue, 29 Mar 2022 19:07:57 +0200	[thread overview]
Message-ID: <fa67e24a-1e6c-a3b7-0db1-ea2be261dfa3@gmail.com> (raw)
In-Reply-To: <CAFEAcA-g=XaURutqWd6okRHb3-pz3SegaxRMG5j2s+PThQHdGQ@mail.gmail.com>

On 28/3/22 11:15, Peter Maydell wrote:
> On Mon, 28 Mar 2022 at 09:48, <marcandre.lureau@redhat.com> wrote:
>>
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Signed-off-by: Marc-André Lureau <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..5b6f4330a5f3 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%x", i);
>> +        g_autofree char *dist_alias_name = g_strdup_printf("exynos4210-gic-alias_dist%x", i);

Dubious '%x' format... Maybe change to '%u'?

>>           /* 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),
>> --
> 
> More false positives, but here the new code is massively better than the old.
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM
> 



  reply	other threads:[~2022-03-29 17:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  8:47 [PATCH 0/5] Compilation fixes for 7.0 marcandre.lureau
2022-03-28  8:47 ` [PATCH 1/5] trace: fix compilation with lttng-ust >= 2.13 marcandre.lureau
2022-03-30 12:06   ` Stefan Hajnoczi
2022-03-31 15:45     ` Marc-André Lureau
2022-03-31 16:08       ` Stefan Hajnoczi
2022-03-28  8:47 ` [PATCH 2/5] arm/digic: fix format-truncation warning marcandre.lureau
2022-03-28  9:12   ` Peter Maydell
2022-03-28  9:21   ` Thomas Huth
2022-03-28  8:47 ` [PATCH 3/5] arm/allwinner-a10: fix format-overflow warning marcandre.lureau
2022-03-28  9:13   ` Peter Maydell
2022-03-28  8:47 ` [PATCH 4/5] intc/exynos4210_gic: " marcandre.lureau
2022-03-28  9:15   ` Peter Maydell
2022-03-29 17:07     ` Philippe Mathieu-Daudé [this message]
2022-03-29 17:23       ` Peter Maydell
2022-03-28  8:47 ` [PATCH 5/5] s390x/tcg: fix format-truncation warning marcandre.lureau
2022-03-28  8:58   ` Thomas Huth
2022-03-28 10:22     ` Marc-André Lureau
2022-03-28 10:57       ` Thomas Huth
2022-03-29 14:44       ` Thomas Huth
2022-03-28  9:01   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa67e24a-1e6c-a3b7-0db1-ea2be261dfa3@gmail.com \
    --to=philippe.mathieu.daude@gmail.com \
    --cc=antonynpavlov@gmail.com \
    --cc=b.galvani@gmail.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=i.mitsyanko@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).