mbox series

[00/19] -Werror=maybe-uninitialized fixes

Message ID 20240328102052.3499331-1-marcandre.lureau@redhat.com
Headers show
Series -Werror=maybe-uninitialized fixes | expand

Message

Marc-André Lureau March 28, 2024, 10:20 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

Depending on -Doptimization=<value>, GCC (13.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

Marc-André Lureau (19):
  util/coroutine: fix -Werror=maybe-uninitialized false-positive
  util/timer: with -Werror=maybe-uninitialized false-positive
  hw/qxl: fix -Werror=maybe-uninitialized false-positives
  nbd: with -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
  hw/rdma: fix -Werror=maybe-uninitialized false-positive
  migration/block: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positives
  hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive
  plugins: fix -Werror=maybe-uninitialized false-positive
  migration: fix -Werror=maybe-uninitialized false-positive
  tests: fix -Werror=maybe-uninitialized
  hw/nvme: fix -Werror=maybe-uninitialized
  hw/virtio: fix -Werror=maybe-uninitialized
  RFC: hw/virtio: a potential leak fix

 block/mirror.c                     | 2 +-
 block/stream.c                     | 6 +++---
 hw/block/virtio-blk.c              | 2 +-
 hw/display/qxl.c                   | 4 ++--
 hw/ide/ahci.c                      | 3 ++-
 hw/nvme/ctrl.c                     | 2 +-
 hw/rdma/rdma_backend.c             | 2 +-
 hw/scsi/vhost-scsi.c               | 2 +-
 hw/sd/sdhci.c                      | 2 +-
 hw/virtio/vhost-shadow-virtqueue.c | 6 ++++--
 migration/block.c                  | 2 +-
 migration/dirtyrate.c              | 4 ++--
 migration/migration.c              | 2 +-
 migration/ram.c                    | 2 +-
 nbd/client-connection.c            | 2 +-
 plugins/loader.c                   | 2 +-
 tests/unit/test-bdrv-drain.c       | 2 +-
 tests/unit/test-block-iothread.c   | 2 +-
 util/qemu-coroutine.c              | 2 +-
 util/qemu-timer.c                  | 6 +++---
 20 files changed, 30 insertions(+), 27 deletions(-)

Comments

Eric Blake March 28, 2024, 2:31 p.m. UTC | #1
On Thu, Mar 28, 2024 at 02:20:33PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Hi,
> 
> Depending on -Doptimization=<value>, GCC (13.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

Couple of subject lines are inconsistent; I suggest:

> 
> Marc-André Lureau (19):
>   util/coroutine: fix -Werror=maybe-uninitialized false-positive
>   util/timer: with -Werror=maybe-uninitialized false-positive

s/with/fix/

>   hw/qxl: fix -Werror=maybe-uninitialized false-positives
>   nbd: with -Werror=maybe-uninitialized false-positive

s/with/fix/

>   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
>   hw/rdma: fix -Werror=maybe-uninitialized false-positive
>   migration/block: fix -Werror=maybe-uninitialized false-positive
>   migration: fix -Werror=maybe-uninitialized false-positives
>   hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive
>   plugins: fix -Werror=maybe-uninitialized false-positive
>   migration: fix -Werror=maybe-uninitialized false-positive
>   tests: fix -Werror=maybe-uninitialized
>   hw/nvme: fix -Werror=maybe-uninitialized
>   hw/virtio: fix -Werror=maybe-uninitialized
>   RFC: hw/virtio: a potential leak fix
>