[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 15/26] do not check pointers after dereferencing th
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 15/26] do not check pointers after dereferencing them |
Date: |
Wed, 12 Jun 2013 16:41:27 -0500 |
From: Paolo Bonzini <address@hidden>
Two instances, both spotted by Coverity. In one, two blocks were
swapped. In the other, the check is not needed anymore.
Cc: address@hidden
Cc: address@hidden
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
(cherry picked from commit a4cc73d629d43c8a4d171d043ff229a959df3ca6)
Signed-off-by: Michael Roth <address@hidden>
---
monitor.c | 2 +-
savevm.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/monitor.c b/monitor.c
index 62aaebe..dee980c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -281,7 +281,7 @@ void monitor_flush(Monitor *mon)
buf = qstring_get_str(mon->outbuf);
len = qstring_get_length(mon->outbuf);
- if (mon && len && !mon->mux_out) {
+ if (len && !mon->mux_out) {
rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len);
if (rc == len) {
/* all flushed */
diff --git a/savevm.c b/savevm.c
index 31dcce9..4e0fab6 100644
--- a/savevm.c
+++ b/savevm.c
@@ -322,13 +322,13 @@ QEMUFile *qemu_popen_cmd(const char *command, const char
*mode)
FILE *stdio_file;
QEMUFileStdio *s;
- stdio_file = popen(command, mode);
- if (stdio_file == NULL) {
+ if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
+ fprintf(stderr, "qemu_popen: Argument validity check failed\n");
return NULL;
}
- if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
- fprintf(stderr, "qemu_popen: Argument validity check failed\n");
+ stdio_file = popen(command, mode);
+ if (stdio_file == NULL) {
return NULL;
}
--
1.7.9.5
- [Qemu-stable] [PATCH 04/26] qom/object: Don't poll cast cache for NULL objects, (continued)
- [Qemu-stable] [PATCH 04/26] qom/object: Don't poll cast cache for NULL objects, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 05/26] xen: simplify xen_enabled, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 06/26] main_loop: do not set nonblocking if xen_enabled(), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 07/26] xen_machine_pv: do not create a dummy CPU in machine->init, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 08/26] chardev: fix "info chardev" output, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 09/26] ide: Set BSY bit during FLUSH, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 10/26] Revert "roms: switch oldnoconfig to olddefconfig", Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 12/26] target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 13/26] Remove OSS support for OpenBSD, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 14/26] xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 15/26] do not check pointers after dereferencing them,
Michael Roth <=
- [Qemu-stable] [PATCH 16/26] qdev: fix get_fw_dev_path to support to add nothing to fw_dev_path, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 17/26] host-libusb: Correct test for USB packet state, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 18/26] Fix usage of USB_DEV_FLAG_IS_HOST flag., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 20/26] ui/gtk.c: Fix *BSD build of Gtk+ UI, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 19/26] vmxnet3: fix NICState cleanup, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 22/26] virtio-ccw: Fix unsetting of indicators., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 21/26] s390x/css: Fix concurrent sense., Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 24/26] qemu-char: don't issue CHR_EVENT_OPEN in a BH, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 25/26] target-i386: Fix aflag logic for CODE64 and the 0x67 prefix, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 26/26] q35: set fw_name, Michael Roth, 2013/06/12