Skip to contentSkip to conversation

Trivial patches for October 15 to 26 2011

GIT PULL New Stefan Hajnoczi 2 participants 12 messages Oct 26, 2011 – Oct 31, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit d300854b1ccd036e0d7c58d789f4ab8d372263e6:

target-sparc: Fix use of g_new0 / g_free (2011-10-25 19:30:33 +0000)

are available in the git repository at:
ssh://repo.or.cz/srv/git/qemu/stefanha.git trivial-patches

Bernhard Reutner-Fischer (1):
Documentation: fix typo

Hervé Poussineau (1):

      Fix typo: buf -> bus

Max Filippov (1):
ahci: fix DPRINTF format strings

Paolo Bonzini (1):
tools: reorganize Makefile variables

Pavel Borzenkov (4):
vmdk: remove unneeded variable assignment
vmdk: vmdk_read_cid returns garbage if p_name is NULL
qed: don't pass NULL to memcpy
qed: remove unneeded variable assignment

Stefan Weil (1):
device_tree: Fix potential memory leak

陳韋任 (1):
exec.c: Remove useless comment

 Makefile      |   32 +++++++++++++++-----------------
 Makefile.objs |    8 ++++----
 block/qed.c   |    7 ++++---
 block/vmdk.c  |    3 +--
 device_tree.c |    1 +
 exec.c        |    1 -
 hw/audiodev.h |    2 +-
 hw/ide/ahci.c |   16 ++++++++++------
 qemu-doc.texi |    2 +-
 9 files changed, 37 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.7
#1 lore raw

PATCH 1/10 device_tree: Fix potential memory leak

From: Stefan Weil <[email protected]>

cppcheck error report:

device_tree.c:156: error: Memory leak: dupname

---
 device_tree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
device_tree.c +1 -0
index dc69232..86a694c 100644
@@ -153,6 +153,7 @@ int qemu_devtree_add_subnode(void *fdt, const char *name)
     int retval;
 
     if (!basename) {
+        g_free(dupname);
         return -1;
     }
 
Signature · 1 line
1.7.7
#2 lore raw

PATCH 2/10 vmdk: remove unneeded variable assignment

In reply to Stefan Hajnoczi

From: Pavel Borzenkov <[email protected]>

Spotted by Clang Analyzer

---
 block/vmdk.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
block/vmdk.c +0 -1
index 5d16ec4..3969131 100644
@@ -1387,7 +1387,6 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
             bdrv_delete(bs);
             return -EINVAL;
         }
-        filesize = bdrv_getlength(bs);
         parent_cid = vmdk_read_cid(bs, 0);
         bdrv_delete(bs);
         relative_path(parent_filename, sizeof(parent_filename),
Signature · 1 line
1.7.7
#3 lore raw

PATCH 3/10 vmdk: vmdk_read_cid returns garbage if p_name is NULL

In reply to Stefan Hajnoczi

From: Pavel Borzenkov <[email protected]>

Spotted by Clang Analyzer

---
 block/vmdk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/vmdk.c +1 -1
index 3969131..a75dcc2 100644
@@ -207,7 +207,7 @@ static void vmdk_free_last_extent(BlockDriverState *bs)
 static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
 {
     char desc[DESC_SIZE];
-    uint32_t cid;
+    uint32_t cid = 0xffffffff;
     const char *p_name, *cid_str;
     size_t cid_str_size;
     BDRVVmdkState *s = bs->opaque;
Signature · 1 line
1.7.7
#4 lore raw

PATCH 4/10 qed: don't pass NULL to memcpy

In reply to Stefan Hajnoczi

From: Pavel Borzenkov <[email protected]>

Spotted by Clang Analyzer

[Note this memcpy call has always been safe because the length will be 0 when the pointer is NULL]

---
 block/qed.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
block/qed.c +4 -2
index e87dc4d..7fab155 100644
@@ -1425,8 +1425,10 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs,
     memcpy(buffer, &le_header, sizeof(le_header));
     buffer_len = sizeof(le_header);
 
-    memcpy(buffer + buffer_len, backing_file, backing_file_len);
-    buffer_len += backing_file_len;
+    if (backing_file) {
+        memcpy(buffer + buffer_len, backing_file, backing_file_len);
+        buffer_len += backing_file_len;
+    }
 
     /* Write new header */
     ret = bdrv_pwrite_sync(bs->file, 0, buffer, buffer_len);
Signature · 1 line
1.7.7
#5 lore raw

PATCH 5/10 qed: remove unneeded variable assignment

In reply to Stefan Hajnoczi

From: Pavel Borzenkov <[email protected]>

'ret' is unconditionally overwitten by qed_read_l1_table_sync()

Spotted by Clang Analyzer

---
 block/qed.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
block/qed.c +0 -1
index 7fab155..e6720db 100644
@@ -388,7 +388,6 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
     if (ret < 0) {
         return ret;
     }
-    ret = 0; /* ret should always be 0 or -errno */
     qed_header_le_to_cpu(&le_header, &s->header);
 
     if (s->header.magic != QED_MAGIC) {
Signature · 1 line
1.7.7
#6 lore raw

PATCH 6/10 exec.c: Remove useless comment

In reply to Stefan Hajnoczi

From: 陳韋任 <[email protected]>

As phys_ram_size had been removed since QEMU 0.12. Remove the useless
comment.

---
 exec.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
exec.c +0 -1
index 9dc4edb..2f3c6a0 100644
@@ -469,7 +469,6 @@ static void code_gen_alloc(unsigned long tb_size)
     code_gen_buffer_size = tb_size;
     if (code_gen_buffer_size == 0) {
 #if defined(CONFIG_USER_ONLY)
-        /* in user mode, phys_ram_size is not meaningful */
         code_gen_buffer_size = DEFAULT_CODE_GEN_BUFFER_SIZE;
 #else
         /* XXX: needs adjustments */
Signature · 1 line
1.7.7
#7 lore raw

PATCH 7/10 tools: reorganize Makefile variables

In reply to Stefan Hajnoczi

From: Paolo Bonzini <[email protected]>

- Add all dependencies of the block layer to block-obj-y, and all dependencies of QObject to qobject-obj-y

- Remove the block layer from tools-obj-y, add it to qemu-img, qemu-nbd, qemu-io

- Add qobject-obj-y and tools-obj-y wherever useful, remove duplicates

---
 Makefile      |   32 +++++++++++++++-----------------
 Makefile.objs |    8 ++++----
 2 files changed, 19 insertions(+), 21 deletions(-)
Makefile +15 -17
index f63fc02..ba8d738 100644
@@ -146,27 +146,25 @@ endif
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o qemu-ga.o: $(GENERATED_HEADERS)
 
-tools-obj-y = qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) \
-        $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
+tools-obj-y = qemu-tool.o $(oslib-obj-y) $(trace-obj-y) \
+	qemu-timer-common.o cutils.o
 
-qemu-img$(EXESUF): qemu-img.o $(tools-obj-y)
-qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y)
-qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y)
+qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
+qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
 
-CHECK_PROG_DEPS = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o
-
-check-qint: check-qint.o qint.o $(CHECK_PROG_DEPS)
-check-qstring: check-qstring.o qstring.o $(CHECK_PROG_DEPS)
-check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(CHECK_PROG_DEPS)
-check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS)
-check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS)
-check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o error.o qerror.o qemu-error.o $(CHECK_PROG_DEPS)
-test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(CHECK_PROG_DEPS)
+check-qint: check-qint.o qint.o $(tools-obj-y)
+check-qstring: check-qstring.o qstring.o $(tools-obj-y)
+check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(tools-obj-y)
+check-qlist: check-qlist.o qlist.o qint.o $(tools-obj-y)
+check-qfloat: check-qfloat.o qfloat.o $(tools-obj-y)
+check-qjson: check-qjson.o $(qobject-obj-y) $(tools-obj-y)
+test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
 
 $(qapi-obj-y): $(GENERATED_HEADERS)
 qapi-dir := qapi-generated
@@ -204,16 +202,16 @@ qmp-marshal.c: $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py
 	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -m -o "." < $<, "  GEN   $@")
 
 test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
-test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
+test-visitor: test-visitor.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
 
 test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h) $(qapi-obj-y)
-test-qmp-commands: test-qmp-commands.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
+test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
 
 QGALIB_GEN=$(addprefix $(qapi-dir)/, qga-qapi-types.c qga-qapi-types.h qga-qapi-visit.c qga-qmp-marshal.c)
 $(QGALIB_GEN): $(GENERATED_HEADERS)
 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
 
-qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(trace-obj-y) $(qobject-obj-y) $(version-obj-y) $(addprefix $(qapi-dir)/, qga-qapi-visit.o qga-qapi-types.o qga-qmp-marshal.o)
+qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qobject-obj-y) $(version-obj-y) $(addprefix $(qapi-dir)/, qga-qapi-visit.o qga-qapi-types.o qga-qmp-marshal.o)
 
 QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
 
Makefile.objs +4 -4
index 01587c8..a19e7c5 100644
@@ -2,7 +2,7 @@
 # QObject
 qobject-obj-y = qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o
 qobject-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o
-qobject-obj-y += qerror.o error.o
+qobject-obj-y += qerror.o error.o qemu-error.o
 
 #######################################################################
 # oslib-obj-y is code depending on the OS (win32 vs posix)
@@ -25,7 +25,7 @@ coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o
 
 block-obj-y = cutils.o cache-utils.o qemu-option.o module.o async.o
 block-obj-y += nbd.o block.o aio.o aes.o qemu-config.o qemu-progress.o qemu-sockets.o
-block-obj-y += $(coroutine-obj-y)
+block-obj-y += $(coroutine-obj-y) $(qobject-obj-y) $(version-obj-y)
 block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
 block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
 
@@ -76,7 +76,7 @@ common-obj-y = $(block-obj-y) blockdev.o
 common-obj-y += $(net-obj-y)
 common-obj-y += $(qobject-obj-y)
 common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
-common-obj-y += readline.o console.o cursor.o qemu-error.o
+common-obj-y += readline.o console.o cursor.o
 common-obj-y += $(oslib-obj-y)
 common-obj-$(CONFIG_WIN32) += os-win32.o
 common-obj-$(CONFIG_POSIX) += os-posix.o
@@ -415,7 +415,7 @@ common-obj-y += qmp.o hmp.o
 
 qga-nested-y = guest-agent-commands.o guest-agent-command-state.o
 qga-obj-y = $(addprefix qga/, $(qga-nested-y))
-qga-obj-y += qemu-ga.o qemu-tool.o qemu-error.o qemu-sockets.o module.o qemu-option.o cutils.o osdep.o
+qga-obj-y += qemu-ga.o qemu-sockets.o module.o qemu-option.o
 qga-obj-$(CONFIG_WIN32) += oslib-win32.o
 qga-obj-$(CONFIG_POSIX) += oslib-posix.o
 
Signature · 1 line
1.7.7
#8 lore raw

PATCH 8/10 Fix typo: buf -> bus

In reply to Stefan Hajnoczi

From: Hervé Poussineau <[email protected]>

---
 hw/audiodev.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/audiodev.h +1 -1
index 8e930b2..d60c349 100644
@@ -11,7 +11,7 @@ int Adlib_init(qemu_irq *pic);
 int GUS_init(qemu_irq *pic);
 
 /* ac97.c */
-int ac97_init(PCIBus *buf);
+int ac97_init(PCIBus *bus);
 
 /* cs4231a.c */
 int cs4231a_init(qemu_irq *pic);
Signature · 1 line
1.7.7
#9 lore raw

PATCH 9/10 Documentation: fix typo

In reply to Stefan Hajnoczi

From: Bernhard Reutner-Fischer <[email protected]>

---
 qemu-doc.texi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-doc.texi +1 -1
index ad19b73..149e9bd 100644
@@ -227,7 +227,7 @@ QEMU uses YM3812 emulation by Tatsuyuki Satoh.
 QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
 by Tibor "TS" Schütz.
 
-Not that, by default, GUS shares IRQ(7) with parallel ports and so
+Note that, by default, GUS shares IRQ(7) with parallel ports and so
 qemu must be told to not have parallel ports to have working GUS
 
 @example
Signature · 1 line
1.7.7
#10 lore raw

PATCH 10/10 ahci: fix DPRINTF format strings

In reply to Stefan Hajnoczi

From: Max Filippov <[email protected]>

---
 hw/ide/ahci.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
hw/ide/ahci.c +10 -6
index 1c7e3a0..0af201d 100644
@@ -327,7 +327,7 @@ static void ahci_mem_write(void *opaque, target_phys_addr_t addr,
     }
 
     if (addr < AHCI_GENERIC_HOST_CONTROL_REGS_MAX_ADDR) {
-        DPRINTF(-1, "(addr 0x%08X), val 0x%08X\n", (unsigned) addr, val);
+        DPRINTF(-1, "(addr 0x%08X), val 0x%08"PRIX64"\n", (unsigned) addr, val);
 
         switch (addr) {
             case HOST_CAP: /* R/WO, RO */
@@ -777,7 +777,8 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
     ncq_tfs->sector_count = ((uint16_t)ncq_fis->sector_count_high << 8) |
                                 ncq_fis->sector_count_low;
 
-    DPRINTF(port, "NCQ transfer LBA from %ld to %ld, drive max %ld\n",
+    DPRINTF(port, "NCQ transfer LBA from %"PRId64" to %"PRId64", "
+            "drive max %"PRId64"\n",
             ncq_tfs->lba, ncq_tfs->lba + ncq_tfs->sector_count - 2,
             s->dev[port].port.ifs[0].nb_sectors - 1);
 
@@ -786,10 +787,12 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
 
     switch(ncq_fis->command) {
         case READ_FPDMA_QUEUED:
-            DPRINTF(port, "NCQ reading %d sectors from LBA %ld, tag %d\n",
+            DPRINTF(port, "NCQ reading %d sectors from LBA %"PRId64", "
+                    "tag %d\n",
                     ncq_tfs->sector_count-1, ncq_tfs->lba, ncq_tfs->tag);
 
-            DPRINTF(port, "tag %d aio read %ld\n", ncq_tfs->tag, ncq_tfs->lba);
+            DPRINTF(port, "tag %d aio read %"PRId64"\n",
+                    ncq_tfs->tag, ncq_tfs->lba);
 
             bdrv_acct_start(ncq_tfs->drive->port.ifs[0].bs, &ncq_tfs->acct,
                             (ncq_tfs->sector_count-1) * BDRV_SECTOR_SIZE,
@@ -799,10 +802,11 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
                                            ncq_cb, ncq_tfs);
             break;
         case WRITE_FPDMA_QUEUED:
-            DPRINTF(port, "NCQ writing %d sectors to LBA %ld, tag %d\n",
+            DPRINTF(port, "NCQ writing %d sectors to LBA %"PRId64", tag %d\n",
                     ncq_tfs->sector_count-1, ncq_tfs->lba, ncq_tfs->tag);
 
-            DPRINTF(port, "tag %d aio write %ld\n", ncq_tfs->tag, ncq_tfs->lba);
+            DPRINTF(port, "tag %d aio write %"PRId64"\n",
+                    ncq_tfs->tag, ncq_tfs->lba);
 
             bdrv_acct_start(ncq_tfs->drive->port.ifs[0].bs, &ncq_tfs->acct,
                             (ncq_tfs->sector_count-1) * BDRV_SECTOR_SIZE,
Signature · 1 line
1.7.7
#11 lore raw
In reply to Stefan Hajnoczi
Quoted 6 lines · Stefan Hajnoczi

The following changes since commit d300854b1ccd036e0d7c58d789f4ab8d372263e6:

   target-sparc: Fix use of g_new0 / g_free (2011-10-25 19:30:33 +0000)

are available in the git repository at:
ssh://repo.or.cz/srv/git/qemu/stefanha.git trivial-patches

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 36 lines

Bernhard Reutner-Fischer (1):
Documentation: fix typo

Hervé Poussineau (1):

       Fix typo: buf ->  bus

Max Filippov (1):
ahci: fix DPRINTF format strings

Paolo Bonzini (1):
tools: reorganize Makefile variables

Pavel Borzenkov (4):
vmdk: remove unneeded variable assignment
vmdk: vmdk_read_cid returns garbage if p_name is NULL
qed: don't pass NULL to memcpy
qed: remove unneeded variable assignment

Stefan Weil (1):
device_tree: Fix potential memory leak

陳韋任 (1):
exec.c: Remove useless comment

  Makefile      |   32 +++++++++++++++-----------------
  Makefile.objs |    8 ++++----
  block/qed.c   |    7 ++++---
  block/vmdk.c  |    3 +--
  device_tree.c |    1 +
  exec.c        |    1 -
  hw/audiodev.h |    2 +-
  hw/ide/ahci.c |   16 ++++++++++------
  qemu-doc.texi |    2 +-
  9 files changed, 37 insertions(+), 35 deletions(-)