All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: 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 3/5] arm/allwinner-a10: fix format-overflow warning
Date: Mon, 28 Mar 2022 09:13:32 +0000	[thread overview]
Message-ID: <CAFEAcA8-46DdsxXeWSb_smnGdBvQ0D31B1STC1O5pQNjJcfQqw@mail.gmail.com> (raw)
In-Reply-To: <20220328084717.367993-4-marcandre.lureau@redhat.com>

On Mon, 28 Mar 2022 at 09:48, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> ../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 <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 05e84728cb34..79082289ea5b 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);

Another false positive. Maybe we should feed this back to the
compiler devs for them to improve their warning generation?

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


  reply	other threads:[~2022-03-28  9:18 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 [this message]
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é
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=CAFEAcA8-46DdsxXeWSb_smnGdBvQ0D31B1STC1O5pQNjJcfQqw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.