qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/22] -Werror=maybe-uninitialized fixes
@ 2024-09-24 13:05 marcandre.lureau
  2024-09-24 13:05 ` [PATCH v2 01/22] util/coroutine: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
                   ` (22 more replies)
  0 siblings, 23 replies; 39+ messages in thread
From: marcandre.lureau @ 2024-09-24 13:05 UTC (permalink / raw)
  To: qemu-devel
  Cc: Song Gao, Peter Xu, Bin Meng, Mahmoud Mandour, Hyman Huang,
	Klaus Jensen, Alexandre Iooss, Alex Bennée, Marcel Apfelbaum,
	Daniel P. Berrangé, John Snow, Jesper Devantier, Bin Meng,
	Greg Kurz, Eugenio Pérez, Stefan Hajnoczi, Yuval Shaia,
	Michael S. Tsirkin, Philippe Mathieu-Daudé, Paolo Bonzini,
	Vladimir Sementsov-Ogievskiy, Christian Schoenebeck,
	Pierrick Bouvier, Fabiano Rosas, Keith Busch, Eric Blake,
	qemu-block, Kevin Wolf, Laurent Vivier, Gerd Hoffmann, Fam Zheng,
	Eduardo Habkost, Stefano Garzarella, Hanna Reitz,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

Depending on -Doptimization=<value>, GCC (14.2.1 here) produces different
maybe-uninitialized warnings:
- g: produces -Werror=maybe-uninitialized errors
- 0: clean build
- 1: produces -Werror=maybe-uninitialized errors
- 2: clean build
- 3: produces few -Werror=maybe-uninitialized errors
- s: produces -Werror=maybe-uninitialized errors

Most are false-positive, because prior LOCK_GUARD should guarantee an
initialization path. Few of them are a bit trickier. Finally, I found
a potential related memory leak.

thanks

v2:
 - rebased, dropped some patches
 - added some new patches with updated code-base and newer GCC
 - added s-o-b/a-b

Marc-André Lureau (22):
  util/coroutine: fix -Werror=maybe-uninitialized false-positive
  util/timer: fix -Werror=maybe-uninitialized false-positive
  hw/qxl: fix -Werror=maybe-uninitialized false-positives
  nbd: fix -Werror=maybe-uninitialized false-positive
  block/mirror: fix -Werror=maybe-uninitialized false-positive
  block/mirror: fix -Werror=maybe-uninitialized false-positive
  block/stream: fix -Werror=maybe-uninitialized false-positives
  hw/ahci: fix -Werror=maybe-uninitialized false-positive
  hw/vhost-scsi: fix -Werror=maybe-uninitialized
  hw/sdhci: fix -Werror=maybe-uninitialized false-positive
  block/block-copy: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positives
  hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positive
  linux-user/hppa: fix -Werror=maybe-uninitialized false-positive
  target/loongarch: fix -Werror=maybe-uninitialized false-positive
  tests: fix -Werror=maybe-uninitialized false-positive
  hw/virtio: fix -Werror=maybe-uninitialized false-positive
  block: fix -Werror=maybe-uninitialized false-positive
  qom/object: fix -Werror=maybe-uninitialized
  fsdep/9p: fix -Werror=maybe-uninitialized false-positive
  RFC: hw/virtio: a potential leak fix

 block/block-copy.c                 |  2 +-
 block/file-posix.c                 |  2 +-
 block/mirror.c                     |  8 ++++----
 block/stream.c                     |  6 +++---
 fsdev/9p-iov-marshal.c             |  6 +++---
 hw/block/virtio-blk.c              |  2 +-
 hw/display/qxl.c                   |  4 ++--
 hw/ide/ahci.c                      |  3 ++-
 hw/scsi/vhost-scsi.c               |  2 +-
 hw/sd/sdhci.c                      |  2 +-
 hw/virtio/vhost-shadow-virtqueue.c |  6 ++++--
 linux-user/hppa/cpu_loop.c         | 10 +++++-----
 migration/dirtyrate.c              |  4 ++--
 migration/migration.c              |  2 +-
 migration/ram.c                    |  2 +-
 nbd/client-connection.c            |  2 +-
 qom/object.c                       |  5 ++++-
 target/loongarch/gdbstub.c         | 26 ++++++++++++++------------
 tests/unit/test-bdrv-drain.c       |  2 +-
 tests/unit/test-block-iothread.c   |  2 +-
 util/qemu-coroutine.c              |  2 +-
 util/qemu-timer.c                  |  6 +++---
 22 files changed, 57 insertions(+), 49 deletions(-)

-- 
2.45.2.827.g557ae147e6



^ permalink raw reply	[flat|nested] 39+ messages in thread
* [PATCH v2 00/22] -Werror=maybe-uninitialized fixes
@ 2024-09-24 13:01 marcandre.lureau
  2024-09-24 13:02 ` [PATCH v2 03/22] hw/qxl: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
  0 siblings, 1 reply; 39+ messages in thread
From: marcandre.lureau @ 2024-09-24 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marcel Apfelbaum, Philippe Mathieu-Daudé,
	Vladimir Sementsov-Ogievskiy, Hanna Reitz, Greg Kurz,
	Paolo Bonzini, Klaus Jensen, Stefano Garzarella, Alexandre Iooss,
	Eric Blake, John Snow, Pierrick Bouvier, Alex Bennée,
	Fam Zheng, Michael S. Tsirkin, Keith Busch, Hyman Huang,
	Laurent Vivier, Fabiano Rosas, Christian Schoenebeck,
	Stefan Hajnoczi, Mahmoud Mandour, Jesper Devantier, Peter Xu,
	Gerd Hoffmann, Bin Meng, Song Gao, Daniel P. Berrangé,
	Eugenio Pérez, Yuval Shaia, Kevin Wolf, Eduardo Habkost,
	qemu-block, Bin Meng, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

Depending on -Doptimization=<value>, GCC (14.2.1 here) produces different
maybe-uninitialized warnings:
- g: produces -Werror=maybe-uninitialized errors
- 0: clean build
- 1: produces -Werror=maybe-uninitialized errors
- 2: clean build
- 3: produces few -Werror=maybe-uninitialized errors
- s: produces -Werror=maybe-uninitialized errors

Most are false-positive, because prior LOCK_GUARD should guarantee an
initialization path. Few of them are a bit trickier. Finally, I found
a potential related memory leak.

thanks

v2:
 - rebased, dropped some patches
 - added some new patches with updated code-base and newer GCC
 - added s-o-b/a-b

Marc-André Lureau (22):
  util/coroutine: fix -Werror=maybe-uninitialized false-positive
  util/timer: fix -Werror=maybe-uninitialized false-positive
  hw/qxl: fix -Werror=maybe-uninitialized false-positives
  nbd: fix -Werror=maybe-uninitialized false-positive
  block/mirror: fix -Werror=maybe-uninitialized false-positive
  block/mirror: fix -Werror=maybe-uninitialized false-positive
  block/stream: fix -Werror=maybe-uninitialized false-positives
  hw/ahci: fix -Werror=maybe-uninitialized false-positive
  hw/vhost-scsi: fix -Werror=maybe-uninitialized
  hw/sdhci: fix -Werror=maybe-uninitialized false-positive
  block/block-copy: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positives
  hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positive
  linux-user/hppa: fix -Werror=maybe-uninitialized false-positive
  target/loongarch: fix -Werror=maybe-uninitialized false-positive
  tests: fix -Werror=maybe-uninitialized false-positive
  hw/virtio: fix -Werror=maybe-uninitialized false-positive
  block: fix -Werror=maybe-uninitialized false-positive
  qom/object: fix -Werror=maybe-uninitialized
  fsdep/9p: fix -Werror=maybe-uninitialized false-positive
  RFC: hw/virtio: a potential leak fix

 block/block-copy.c                 |  2 +-
 block/file-posix.c                 |  2 +-
 block/mirror.c                     |  8 ++++----
 block/stream.c                     |  6 +++---
 fsdev/9p-iov-marshal.c             |  6 +++---
 hw/block/virtio-blk.c              |  2 +-
 hw/display/qxl.c                   |  4 ++--
 hw/ide/ahci.c                      |  3 ++-
 hw/scsi/vhost-scsi.c               |  2 +-
 hw/sd/sdhci.c                      |  2 +-
 hw/virtio/vhost-shadow-virtqueue.c |  6 ++++--
 linux-user/hppa/cpu_loop.c         | 10 +++++-----
 migration/dirtyrate.c              |  4 ++--
 migration/migration.c              |  2 +-
 migration/ram.c                    |  2 +-
 nbd/client-connection.c            |  2 +-
 qom/object.c                       |  5 ++++-
 target/loongarch/gdbstub.c         | 26 ++++++++++++++------------
 tests/unit/test-bdrv-drain.c       |  2 +-
 tests/unit/test-block-iothread.c   |  2 +-
 util/qemu-coroutine.c              |  2 +-
 util/qemu-timer.c                  |  6 +++---
 22 files changed, 57 insertions(+), 49 deletions(-)

-- 
2.45.2.827.g557ae147e6



^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2024-09-30  8:31 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 13:05 [PATCH v2 00/22] -Werror=maybe-uninitialized fixes marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 01/22] util/coroutine: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 02/22] util/timer: " marcandre.lureau
2024-09-26  4:39   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 03/22] hw/qxl: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-26  4:40   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 04/22] nbd: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 05/22] block/mirror: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 06/22] " marcandre.lureau
2024-09-26  4:45   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 07/22] block/stream: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-26  4:50   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 08/22] hw/ahci: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-26  4:52   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 09/22] hw/vhost-scsi: fix -Werror=maybe-uninitialized marcandre.lureau
2024-09-25  7:57   ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 10/22] hw/sdhci: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 11/22] block/block-copy: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 12/22] migration: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 13/22] hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-25  7:59   ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 14/22] migration: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 15/22] linux-user/hppa: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 16/22] target/loongarch: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 17/22] tests: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 18/22] hw/virtio: " marcandre.lureau
2024-09-25  8:07   ` Stefano Garzarella
2024-09-27 13:07     ` Eugenio Perez Martin
2024-09-30  8:11       ` Stefano Garzarella
2024-09-30  8:30         ` Eugenio Perez Martin
2024-09-27 13:04   ` Eugenio Perez Martin
2024-09-30  8:08     ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 19/22] block: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 20/22] qom/object: fix -Werror=maybe-uninitialized marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 21/22] fsdep/9p: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 22/22] RFC: hw/virtio: a potential leak fix marcandre.lureau
2024-09-25  8:18   ` Stefano Garzarella
2024-09-24 13:08 ` [PATCH v2 00/22] -Werror=maybe-uninitialized fixes Daniel P. Berrangé
  -- strict thread matches above, loose matches on Subject: below --
2024-09-24 13:01 marcandre.lureau
2024-09-24 13:02 ` [PATCH v2 03/22] hw/qxl: fix -Werror=maybe-uninitialized false-positives marcandre.lureau

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).