From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LV26O-0002d3-58 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 06:09:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LV26K-0002bO-U6 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 06:08:58 -0500 Received: from [199.232.76.173] (port=51258 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LV26K-0002bK-Q4 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 06:08:56 -0500 Received: from mx2.redhat.com ([66.187.237.31]:39292) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LV26K-0000es-3V for qemu-devel@nongnu.org; Thu, 05 Feb 2009 06:08:56 -0500 From: Avi Kivity Date: Thu, 5 Feb 2009 13:08:40 +0200 Message-Id: <1233832126-9046-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 0/6] Unify memory allocation failure handling Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , qemu-devel@nongnu.org Memory allocation failures are a very rare condition on virtual-memory hosts. They are also very difficult to handle correctly (especially in a hardware emulation context). Because of this, it is better to gracefully terminate emulation rather than executing untested or even unwritten recovery code paths. This patchset modifies qemu_malloc() and related functions to terminate on error, and updates callers not to perform their own error handling. In many cases error handling was already missing or incorrect. Avi Kivity (6): Terminate emulation on memory allocation failure block: remove error handling from qemu_malloc() callers audio: remove error handling from qemu_malloc() callers hw: remove error handling from qemu_malloc() callers targets: remove error handling from qemu_malloc() callers toplevel: remove error handling from qemu_malloc() callers aio.c | 2 - audio/audio.c | 23 +-- audio/wavcapture.c | 5 - block-bochs.c | 2 - block-cloop.c | 9 +- block-dmg.c | 6 +- block-parallels.c | 2 - block-qcow2.c | 58 +------ block-raw-posix.c | 2 - block-vmdk.c | 10 - block-vpc.c | 4 - block-vvfat.c | 18 +- block.c | 6 - buffered_file.c | 2 - console.c | 23 --- cris-dis.c | 26 +-- curses.c | 2 - device_tree.c | 4 - exec.c | 25 +-- gdbstub.c | 8 - hw/adlib.c | 7 - hw/apic.c | 4 - hw/arm_gic.c | 2 - hw/arm_sysctl.c | 2 - hw/baum.c | 10 - hw/cs4231.c | 2 - hw/cs4231a.c | 5 - hw/ds1225y.c | 5 - hw/eccmemctl.c | 2 - hw/escc.c | 4 - hw/esp.c | 2 - hw/etraxfs_dma.c | 8 - hw/etraxfs_eth.c | 8 - hw/etraxfs_pic.c | 6 - hw/etraxfs_ser.c | 2 - hw/etraxfs_timer.c | 2 - hw/fdc.c | 6 - hw/fmopl.c | 27 +--- hw/fw_cfg.c | 8 - hw/g364fb.c | 2 - hw/gus.c | 11 - hw/i8259.c | 2 - hw/ide.c | 2 - hw/integratorcp.c | 2 - hw/iommu.c | 2 - hw/jazz_led.c | 2 - hw/m48t59.c | 6 - hw/mac_dbdma.c | 2 - hw/mac_nvram.c | 6 - hw/mc146818rtc.c | 4 - hw/mipsnet.c | 2 - hw/mpcore.c | 2 - hw/mst_fpga.c | 2 - hw/musicpal.c | 14 -- hw/ne2000.c | 2 - hw/parallel.c | 4 - hw/pci.c | 2 - hw/pcnet.c | 2 - hw/pflash_cfi01.c | 2 - hw/pflash_cfi02.c | 2 - hw/pl031.c | 2 - hw/ppc.c | 7 - hw/ppc405_boards.c | 24 +-- hw/ppc405_uc.c | 422 ++++++++++++++++++++----------------------- hw/ppc440_bamboo.c | 2 - hw/ppc4xx_devs.c | 72 ++++---- hw/ppc4xx_pci.c | 2 - hw/ppc_prep.c | 2 - hw/r2d.c | 2 - hw/rc4030.c | 2 - hw/sb16.c | 5 - hw/sbi.c | 2 - hw/serial.c | 4 - hw/sh_intc.c | 4 +- hw/sh_serial.c | 2 - hw/slavio_intctl.c | 4 - hw/slavio_misc.c | 2 - hw/slavio_timer.c | 2 - hw/sparc32_dma.c | 2 - hw/sun4c_intctl.c | 2 - hw/tcx.c | 2 - hw/usb-bt.c | 2 - hw/usb-hid.c | 6 - hw/usb-hub.c | 2 - hw/usb-msd.c | 2 - hw/usb-net.c | 2 - hw/usb-serial.c | 2 - hw/usb-uhci.c | 15 +- hw/usb-wacom.c | 2 - hw/versatilepb.c | 2 - hw/vga.c | 4 - hw/virtio-blk.c | 3 +- hw/virtio.c | 3 +- hw/vmmouse.c | 2 - keymaps.c | 10 +- kvm-all.c | 7 - loader.c | 4 - migration-exec.c | 5 - migration-tcp.c | 2 - monitor.c | 4 - net.c | 14 -- qemu-char.c | 59 ------ qemu-malloc.c | 16 +- qemu-nbd.c | 2 - qemu-tool.c | 6 +- readline.c | 2 - savevm.c | 19 -- sdl.c | 2 - target-alpha/translate.c | 2 - target-arm/helper.c | 4 - target-cris/translate.c | 2 - target-i386/helper.c | 2 - target-i386/kvm.c | 2 - target-m68k/helper.c | 2 - target-mips/translate.c | 2 - target-ppc/helper.c | 2 - target-ppc/kvm_ppc.c | 4 - target-ppc/translate_init.c | 2 - target-sh4/translate.c | 2 - target-sparc/helper.c | 2 - usb-bsd.c | 2 - usb-linux.c | 24 +--- vl.c | 16 -- vnc.c | 9 +- 124 files changed, 314 insertions(+), 956 deletions(-)