[PATCH 00/23] misc: Remove variable-length arrays on the stack

Philippe Mathieu-Daudé posted 23 patches 2 years, 10 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210505211047.1496765-1-philmd@redhat.com
There is a newer version of this series
configure                       |  2 +-
ui/vnc-enc-hextile-template.h   |  3 ++-
block/vpc.c                     |  4 ++--
chardev/baum.c                  | 22 +++++++++++++---------
hw/block/dataplane/virtio-blk.c |  7 ++++---
hw/block/nvme.c                 | 17 +++++++++--------
hw/i386/multiboot.c             |  5 ++---
hw/intc/xics.c                  |  2 +-
hw/net/e1000e_core.c            |  7 ++++---
hw/net/fsl_etsec/rings.c        |  9 ++++-----
hw/net/rocker/rocker_of_dpa.c   |  2 +-
hw/ppc/pnv.c                    |  4 ++--
hw/ppc/spapr.c                  |  8 ++++----
hw/ppc/spapr_pci_nvlink2.c      |  2 +-
hw/usb/hcd-ohci.c               |  7 ++++---
hw/usb/hcd-xhci.c               |  2 +-
io/channel-websock.c            |  2 +-
net/dump.c                      |  2 +-
net/tap.c                       |  2 +-
target/ppc/kvm.c                |  2 +-
tests/unit/test-vmstate.c       |  7 +++----
ui/curses.c                     |  2 +-
ui/spice-display.c              |  2 +-
ui/vnc-enc-tight.c              | 11 ++++++-----
util/iov.c                      |  2 +-
25 files changed, 71 insertions(+), 64 deletions(-)
[PATCH 00/23] misc: Remove variable-length arrays on the stack
Posted by Philippe Mathieu-Daudé 2 years, 10 months ago
Hi,

This series is inspired by Gerd Hoffmann and CVE-2021-3527.
It removes all uses of variable-length arrays in the repository,
then enable the '-Wvla' warning to avoid new code using vla
to be merged.

Mostly trivial patches using GLib autofree.

Please review,

Phil.

(based on usb-20210505-pull-request tag)
Based-on: 20210505130716.1128420-1-kraxel@redhat.com

Philippe Mathieu-Daudé (23):
  block/vpc: Avoid dynamic stack allocation
  chardev/baum: Replace magic values by X_MAX / Y_MAX definitions
  chardev/baum: Use definitions to avoid dynamic stack allocation
  chardev/baum: Avoid dynamic stack allocation
  io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1
  hw/block/dataplane/virtio-blk: Avoid dynamic stack allocation
  hw/block/nvme: Use definition to avoid dynamic stack allocation
  hw/block/nvme: Avoid dynamic stack allocation
  hw/net/e1000e_core: Use definition to avoid dynamic stack allocation
  hw/ppc/pnv: Avoid dynamic stack allocation
  hw/intc/xics: Avoid dynamic stack allocation
  hw/i386/multiboot: Avoid dynamic stack allocation
  hw/usb/hcd-xhci: Avoid dynamic stack allocation
  hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation
  net: Avoid dynamic stack allocation
  ui/curses: Avoid dynamic stack allocation
  ui/spice-display: Avoid dynamic stack allocation
  ui/vnc-enc-hextile: Use definitions to avoid dynamic stack allocation
  ui/vnc-enc-tight: Avoid dynamic stack allocation
  util/iov: Avoid dynamic stack allocation
  target/ppc/kvm: Avoid dynamic stack allocation
  tests/unit/test-vmstate: Avoid dynamic stack allocation
  configure: Prohibit variable-length allocations by using -Wvla CPPFLAG

 configure                       |  2 +-
 ui/vnc-enc-hextile-template.h   |  3 ++-
 block/vpc.c                     |  4 ++--
 chardev/baum.c                  | 22 +++++++++++++---------
 hw/block/dataplane/virtio-blk.c |  7 ++++---
 hw/block/nvme.c                 | 17 +++++++++--------
 hw/i386/multiboot.c             |  5 ++---
 hw/intc/xics.c                  |  2 +-
 hw/net/e1000e_core.c            |  7 ++++---
 hw/net/fsl_etsec/rings.c        |  9 ++++-----
 hw/net/rocker/rocker_of_dpa.c   |  2 +-
 hw/ppc/pnv.c                    |  4 ++--
 hw/ppc/spapr.c                  |  8 ++++----
 hw/ppc/spapr_pci_nvlink2.c      |  2 +-
 hw/usb/hcd-ohci.c               |  7 ++++---
 hw/usb/hcd-xhci.c               |  2 +-
 io/channel-websock.c            |  2 +-
 net/dump.c                      |  2 +-
 net/tap.c                       |  2 +-
 target/ppc/kvm.c                |  2 +-
 tests/unit/test-vmstate.c       |  7 +++----
 ui/curses.c                     |  2 +-
 ui/spice-display.c              |  2 +-
 ui/vnc-enc-tight.c              | 11 ++++++-----
 util/iov.c                      |  2 +-
 25 files changed, 71 insertions(+), 64 deletions(-)

-- 
2.26.3