From: Fabiano Rosas <farosas@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PULL 27/49] meson: Add -Wformat-overflow=2
Date: Tue, 10 Mar 2026 10:47:26 -0300 [thread overview]
Message-ID: <87h5qn23v5.fsf@suse.de> (raw)
In-Reply-To: <20260309155219.62400-28-philmd@linaro.org>
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
>
> https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Warning-Options.html
>> Level 2 warns also about calls that might overflow the destination
>> buffer given an argument of sufficient length or magnitude. At level
>> 2, unknown numeric arguments are assumed to have the minimum
>> representable value for signed types with a precision greater than 1,
>> and the maximum representable value otherwise. Unknown string
>> arguments whose length cannot be assumed to be bounded either by the
>> directive’s precision, or by a finite set of string literals they may
>> evaluate to, or the character array they may point to, are assumed to
>> be 1 character long.
>
> Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Message-ID: <20260305-nvme-v4-4-b65b9de1839f@rsg.ci.i.u-tokyo.ac.jp>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> meson.build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/meson.build b/meson.build
> index 102f0cbb13e..f45885f05a1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -694,6 +694,7 @@ warn_flags = [
> '-Wempty-body',
> '-Wendif-labels',
> '-Wexpansion-to-defined',
> + '-Wformat-overflow=2',
> '-Wformat-security',
> '-Wformat-y2k',
> '-Wignored-qualifiers',
This gives me:
../tests/qtest/ast2700-sgpio-test.c: In function ‘test_output_pins’:
../tests/qtest/ast2700-sgpio-test.c:27:33: error: ‘sprintf’ may write a
terminating nul past the end of the destination
[-Werror=format-overflow=]
../tests/qtest/ast2700-sgpio-test.c: In function ‘test_irq_level_high’:
../tests/qtest/ast2700-sgpio-test.c:85:33: error: ‘sprintf’ may write a
terminating nul past the end of the destination
[-Werror=format-overflow=]
../tests/qtest/arm-cpu-features.c: In function ‘test_query_cpu_model_expansion_kvm’:
../tests/qtest/arm-cpu-features.c:578:35: error: ‘%u’ directive writing
between 1 and 10 bytes into a region of size 5
[-Werror=format-overflow=]
../configure
--target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu,arm-softmmu,ppc64-softmmu,s390x-softmmu,riscv64-softmmu,aarch64-linux-user,loongarch64-softmmu
--disable-plugins --enable-modules --enable-werror
--enable-trace-backends=log,dtrace --enable-debug --enable-docs
--enable-rust --enable-strict-rust-lints
gcc version 7.5.0 (SUSE Linux)
next prev parent reply other threads:[~2026-03-10 13:47 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 15:51 [PULL 00/49] Misc HW patches for 2026-03-09 Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 01/49] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 02/49] hw/i386/pc: Remove deprecated pc-q35/pc-i440fx/xenfv 3.1 machines Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 03/49] hw/i386/pc: Remove PCMachineClass::pvh_enabled field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 04/49] hw/i386/x86: Remove @pvh_enabled argument in x86_load_linux() Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 05/49] hw/core/boards: Remove MachineClass::smbus_no_migration_support field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 06/49] hw/i386/pc: Remove pc_compat_3_1[] array Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 07/49] hw/i386/iommu: Remove IntelIOMMUState::dma_drain field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 08/49] target/i386/cpu: Remove X86CPU::intel_pt_auto_level field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 09/49] hw/core/machine: Remove the hw_compat_3_1[] array Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 10/49] hw/pci-bridge/pcie_rp: Remove PCIESlot::disable_acs field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 11/49] hw/i386/pc: Remove deprecated pc-q35-4.0[.1] and pc-i440fx-4.0 machines Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 12/49] hw/i386/pc: Remove pc_compat_4_0[] array Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 13/49] hw/core/machine: Remove the hw_compat_4_0[] array Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 14/49] hw/virtio: Remove VirtIOBalloon::qemu_4_0_config_size field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 15/49] hw/rtc/pl031: : Remove PL031State::migrate_tick_offset field Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 16/49] tests: fix leaks in dbus-display-test Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 17/49] ui/dbus: fix leak regression Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 18/49] ui/dbus: fix Unix.Map proxy leak Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 19/49] ui/dbus: fix pixman cleanup Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 20/49] coreaudio: Remove unnecessary explicit casts Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 21/49] coreaudio: Remove extra whitespaces Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 22/49] virtio-snd: remove a redundant memory allocation Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 23/49] virtio-snd: remove redundant fields Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 24/49] contrib/elf2dmp: Grow PDB URL buffer Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 25/49] vfio/pci: Grow buffer in vfio_pci_host_match() Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 26/49] tests: Clean up double comparisons to avoid compiler warning Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 27/49] meson: Add -Wformat-overflow=2 Philippe Mathieu-Daudé
2026-03-10 13:47 ` Fabiano Rosas [this message]
2026-03-10 14:37 ` Philippe Mathieu-Daudé
2026-03-10 15:20 ` Peter Maydell
2026-03-10 14:51 ` Peter Maydell
2026-03-10 15:17 ` Minimal GCC version for QEMU (was: Re: [PULL 27/49] meson: Add -Wformat-overflow=2) Thomas Huth
2026-03-10 15:30 ` Daniel P. Berrangé
2026-03-10 15:47 ` Minimal GCC version for QEMU Thomas Huth
2026-03-10 23:06 ` nia
2026-03-11 7:28 ` Thomas Huth
2026-03-11 9:31 ` Daniel P. Berrangé
2026-03-11 9:37 ` Daniel P. Berrangé
2026-03-10 14:53 ` [PULL 27/49] meson: Add -Wformat-overflow=2 Peter Maydell
2026-03-10 15:23 ` Fabiano Rosas
2026-03-09 15:51 ` [PULL 28/49] net/passt: Only kill passt if it wrote a pidfile Philippe Mathieu-Daudé
2026-03-09 15:51 ` [PULL 29/49] net/passt: Don't try to read the pidfile if passt got a signal Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 30/49] hw/net/npcm_gmac: Catch accesses off the end of the register array Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 31/49] hw/sparc/sun4m: Don't set up dummy cpu interrupts Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 32/49] hw/sparc/sun4m: Use qdev GPIOs rather than qemu_allocate_irqs() Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 33/49] hw/timer/slavio_timer: Free resources allocated in instance_init Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 34/49] hw/qdev: Document qdev_get_dev_path() Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 35/49] hw: Make qdev_get_printable_name() consistently return freeable string Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 36/49] ati-vga: Remove src and dst stride mutation in ati_2d_blt Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 37/49] ati-vga: Use local variables for register values " Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 38/49] ati-vga: Introduce ATI2DCtx struct for 2D blit context Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 39/49] ati-vga: Extract setup_2d_blt_ctx from ati_2d_blt Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 40/49] ati-vga: Split ati_2d_do_blt " Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 41/49] ati-vga: Remove ATIVGAState param from ati_2d_do_blt Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 42/49] ati-vga: Implement scissor rectangle clipping for 2D operations Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 43/49] ati-vga: Implement HOST_DATA register writes Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 44/49] ati-vga: Implement HOST_DATA flush to VRAM Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 45/49] ati-vga: Simplify hw cursor drawing Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 46/49] ati-vga: Do not access pixel outside the screen Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 47/49] hw/i3c/dw-i3c: Fix memory leaks in error logging paths Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 48/49] hw/misc/sifive_e_aon: Don't leak timer Philippe Mathieu-Daudé
2026-03-09 15:52 ` [PULL 49/49] hw/misc/riscv_cpc: Free CPU array in instance_finalize Philippe Mathieu-Daudé
2026-03-10 9:31 ` [PULL 00/49] Misc HW patches for 2026-03-09 Peter Maydell
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=87h5qn23v5.fsf@suse.de \
--to=farosas@suse.de \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/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