All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/9] Trivial branch for 7.0 patches
@ 2021-12-17 20:10 Laurent Vivier
  2021-12-17 20:10 ` [PULL 1/9] configure: Symlink binaries using .exe suffix with MinGW Laurent Vivier
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Laurent Vivier

The following changes since commit 29eb5c2c86f935b0e9700fad2ecfe8a32b011d57:

  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2021-12-16 08:39:20 -0800)

are available in the Git repository at:

  https://gitlab.com/laurent_vivier/qemu.git tags/trivial-branch-for-7.0-pull-request

for you to fetch changes up to ce2ff9cccf0c5f123f9d1e3d5e4fc07d1c2c159d:

  checkpatch: Do not allow deprecated g_memdup() (2021-12-17 11:57:35 +0100)

----------------------------------------------------------------
Trivial patches pull request 20211217

----------------------------------------------------------------

Leonardo Garcia (1):
  hw/virtio/vhost: Fix typo in comment.

Philippe Mathieu-Daudé (7):
  configure: Symlink binaries using .exe suffix with MinGW
  target/i386/kvm: Replace use of __u32 type
  qemu-keymap: Add license in generated files
  hw/avr: Realize AVRCPU qdev object using qdev_realize()
  glib-compat: Introduce g_memdup2() wrapper
  tests/qtest: Replace g_memdup() by g_memdup2()
  checkpatch: Do not allow deprecated g_memdup()

Zhang Chen (1):
  docs/block-replication.txt: Fix replication top-id command demo

 configure                   |  2 +-
 docs/block-replication.txt  |  2 +-
 hw/avr/atmega.c             |  2 +-
 hw/virtio/vhost.c           |  2 +-
 include/glib-compat.h       | 37 +++++++++++++++++++++++++++++++++++++
 qemu-keymap.c               |  1 +
 scripts/checkpatch.pl       |  5 +++++
 target/i386/kvm/kvm.c       |  2 +-
 tests/qtest/libqos/ahci.c   |  6 +++---
 tests/qtest/libqos/qgraph.c |  2 +-
 10 files changed, 52 insertions(+), 9 deletions(-)

-- 
2.33.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PULL 1/9] configure: Symlink binaries using .exe suffix with MinGW
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 2/9] target/i386/kvm: Replace use of __u32 type Laurent Vivier
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Stefan Weil, Philippe Mathieu-Daudé,
	Laurent Vivier, Paolo Bonzini

From: Philippe Mathieu-Daudé <philmd@redhat.com>

When using the MinGW toolchain, we use the .exe suffix for the
executable name. We also need to use it for the symlinks in the
build directory.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20211109144504.1541206-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 5fae19858d58..28e1cf6291bb 100755
--- a/configure
+++ b/configure
@@ -3754,7 +3754,7 @@ fi
 
 for target in $target_list; do
     target_dir="$target"
-    target_name=$(echo $target | cut -d '-' -f 1)
+    target_name=$(echo $target | cut -d '-' -f 1)$EXESUF
     mkdir -p $target_dir
     case $target in
         *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;;
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 2/9] target/i386/kvm: Replace use of __u32 type
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
  2021-12-17 20:10 ` [PULL 1/9] configure: Symlink binaries using .exe suffix with MinGW Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 3/9] qemu-keymap: Add license in generated files Laurent Vivier
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Richard Henderson, Philippe Mathieu-Daudé,
	Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

QEMU coding style mandates to not use Linux kernel internal
types for scalars types. Replace __u32 by uint32_t.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211116193955.2793171-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/i386/kvm/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 5a698bde19ac..13f8e30c2a54 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1406,7 +1406,7 @@ static int hyperv_fill_cpuids(CPUState *cs,
     c->edx = cpu->hyperv_limits[2];
 
     if (hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS)) {
-        __u32 function;
+        uint32_t function;
 
         /* Create zeroed 0x40000006..0x40000009 leaves */
         for (function = HV_CPUID_IMPLEMENT_LIMITS + 1;
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 3/9] qemu-keymap: Add license in generated files
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
  2021-12-17 20:10 ` [PULL 1/9] configure: Symlink binaries using .exe suffix with MinGW Laurent Vivier
  2021-12-17 20:10 ` [PULL 2/9] target/i386/kvm: Replace use of __u32 type Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 4/9] hw/avr: Realize AVRCPU qdev object using qdev_realize() Laurent Vivier
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé, Laurent Vivier, Warner Losh

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20211117174533.1900570-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 qemu-keymap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 536e8f2385d7..4095b654a607 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -187,6 +187,7 @@ int main(int argc, char *argv[])
     }
 
     fprintf(outfile,
+            "# SPDX-License-Identifier: GPL-2.0-or-later\n"
             "#\n"
             "# generated by qemu-keymap\n"
             "#    model   : %s\n"
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 4/9] hw/avr: Realize AVRCPU qdev object using qdev_realize()
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 3/9] qemu-keymap: Add license in generated files Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 5/9] hw/virtio/vhost: Fix typo in comment Laurent Vivier
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Rolnik, Philippe Mathieu-Daudé,
	Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

TYPE_AVR_CPU inherits TYPE_CPU, which itself inherits TYPE_DEVICE.
TYPE_DEVICE instances are realized using qdev_realize(), we don't
need to access QOM internal values.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Michael Rolnik <mrolnik@gmail.com>
Message-Id: <20211205224109.322152-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/avr/atmega.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c
index 0608e2d475ee..a34803e64272 100644
--- a/hw/avr/atmega.c
+++ b/hw/avr/atmega.c
@@ -233,7 +233,7 @@ static void atmega_realize(DeviceState *dev, Error **errp)
 
     /* CPU */
     object_initialize_child(OBJECT(dev), "cpu", &s->cpu, mc->cpu_type);
-    object_property_set_bool(OBJECT(&s->cpu), "realized", true, &error_abort);
+    qdev_realize(DEVICE(&s->cpu), NULL, &error_abort);
     cpudev = DEVICE(&s->cpu);
 
     /* SRAM */
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 5/9] hw/virtio/vhost: Fix typo in comment.
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 4/9] hw/avr: Realize AVRCPU qdev object using qdev_realize() Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 6/9] docs/block-replication.txt: Fix replication top-id command demo Laurent Vivier
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Leonardo Garcia, Philippe Mathieu-Daudé,
	Laurent Vivier

From: Leonardo Garcia <lagarcia@br.ibm.com>

Signed-off-by: Leonardo Garcia <lagarcia@br.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <a10a0ddab65b474ebea1e1141abe0f4aa463909b.1637668012.git.lagarcia@br.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/virtio/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 437347ad01c9..20913cf8fb4b 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -313,7 +313,7 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev)
      * For vhost, VIRTIO_F_IOMMU_PLATFORM means the backend support
      * incremental memory mapping API via IOTLB API. For platform that
      * does not have IOMMU, there's no need to enable this feature
-     * which may cause unnecessary IOTLB miss/update trnasactions.
+     * which may cause unnecessary IOTLB miss/update transactions.
      */
     return virtio_bus_device_iommu_enabled(vdev) &&
            virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 6/9] docs/block-replication.txt: Fix replication top-id command demo
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (4 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 5/9] hw/virtio/vhost: Fix typo in comment Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 7/9] glib-compat: Introduce g_memdup2() wrapper Laurent Vivier
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Zhang Chen, Laurent Vivier

From: Zhang Chen <chen.zhang@intel.com>

This demo not correct, the original childs1 can't pass the
the bdrv_is_root_node check in replcation_start().
Keep consistent with docs/COLO-FT.txt

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211018085044.2788276-1-chen.zhang@intel.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 docs/block-replication.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/block-replication.txt b/docs/block-replication.txt
index b0f23761c6e7..e1b28a6cc117 100644
--- a/docs/block-replication.txt
+++ b/docs/block-replication.txt
@@ -179,7 +179,7 @@ Primary:
 
 Secondary:
   -drive if=none,driver=raw,file.filename=1.raw,id=colo1 \
-  -drive if=none,id=childs1,driver=replication,mode=secondary,top-id=childs1
+  -drive if=none,id=childs1,driver=replication,mode=secondary,top-id=top-disk1
          file.file.filename=active_disk.qcow2,\
          file.driver=qcow2,\
          file.backing.file.filename=hidden_disk.qcow2,\
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 7/9] glib-compat: Introduce g_memdup2() wrapper
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (5 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 6/9] docs/block-replication.txt: Fix replication top-id command demo Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 8/9] tests/qtest: Replace g_memdup() by g_memdup2() Laurent Vivier
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Eric Blake, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

When experimenting raising GLIB_VERSION_MIN_REQUIRED to 2.68
(Fedora 34 provides GLib 2.68.1) we get:

  hw/virtio/virtio-crypto.c:245:24: error: 'g_memdup' is deprecated: Use 'g_memdup2' instead [-Werror,-Wdeprecated-declarations]
  ...

g_memdup() has been updated by g_memdup2() to fix eventual security
issues (size argument is 32-bit and could be truncated / wrapping).
GLib recommends to copy their static inline version of g_memdup2():
https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538

Our glib-compat.h provides a comment explaining how to deal with
these deprecated declarations (see commit e71e8cc0355
"glib: enforce the minimum required version and warn about old APIs").

Following this comment suggestion, implement the g_memdup2_qemu()
wrapper to g_memdup2(), and use the safer equivalent inlined when
we are using pre-2.68 GLib.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210903174510.751630-3-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 include/glib-compat.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/include/glib-compat.h b/include/glib-compat.h
index 9e95c888f54f..8d01a8c01fb8 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -68,6 +68,43 @@
  * without generating warnings.
  */
 
+/*
+ * g_memdup2_qemu:
+ * @mem: (nullable): the memory to copy.
+ * @byte_size: the number of bytes to copy.
+ *
+ * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
+ * from @mem. If @mem is %NULL it returns %NULL.
+ *
+ * This replaces g_memdup(), which was prone to integer overflows when
+ * converting the argument from a #gsize to a #guint.
+ *
+ * This static inline version is a backport of the new public API from
+ * GLib 2.68, kept internal to GLib for backport to older stable releases.
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2319.
+ *
+ * Returns: (nullable): a pointer to the newly-allocated copy of the memory,
+ *          or %NULL if @mem is %NULL.
+ */
+static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size)
+{
+#if GLIB_CHECK_VERSION(2, 68, 0)
+    return g_memdup2(mem, byte_size);
+#else
+    gpointer new_mem;
+
+    if (mem && byte_size != 0) {
+        new_mem = g_malloc(byte_size);
+        memcpy(new_mem, mem, byte_size);
+    } else {
+        new_mem = NULL;
+    }
+
+    return new_mem;
+#endif
+}
+#define g_memdup2(m, s) g_memdup2_qemu(m, s)
+
 #if defined(G_OS_UNIX)
 /*
  * Note: The fallback implementation is not MT-safe, and it returns a copy of
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 8/9] tests/qtest: Replace g_memdup() by g_memdup2()
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (6 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 7/9] glib-compat: Introduce g_memdup2() wrapper Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-17 20:10 ` [PULL 9/9] checkpatch: Do not allow deprecated g_memdup() Laurent Vivier
  2021-12-18  2:04 ` [PULL 0/9] Trivial branch for 7.0 patches Richard Henderson
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Thomas Huth, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Per https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538

  The old API took the size of the memory to duplicate as a guint,
  whereas most memory functions take memory sizes as a gsize. This
  made it easy to accidentally pass a gsize to g_memdup(). For large
  values, that would lead to a silent truncation of the size from 64
  to 32 bits, and result in a heap area being returned which is
  significantly smaller than what the caller expects. This can likely
  be exploited in various modules to cause a heap buffer overflow.

Replace g_memdup() by the safer g_memdup2() wrapper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210903174510.751630-25-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 tests/qtest/libqos/ahci.c   | 6 +++---
 tests/qtest/libqos/qgraph.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index fba3e7a954ed..eaa2096512e5 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -639,8 +639,8 @@ void ahci_exec(AHCIQState *ahci, uint8_t port,
     AHCIOpts *opts;
     uint64_t buffer_in;
 
-    opts = g_memdup((opts_in == NULL ? &default_opts : opts_in),
-                    sizeof(AHCIOpts));
+    opts = g_memdup2((opts_in == NULL ? &default_opts : opts_in),
+                     sizeof(AHCIOpts));
 
     buffer_in = opts->buffer;
 
@@ -860,7 +860,7 @@ AHCICommand *ahci_command_create(uint8_t command_name)
     g_assert(!props->ncq || props->lba48);
 
     /* Defaults and book-keeping */
-    cmd->props = g_memdup(props, sizeof(AHCICommandProp));
+    cmd->props = g_memdup2(props, sizeof(AHCICommandProp));
     cmd->name = command_name;
     cmd->xbytes = props->size;
     cmd->prd_size = 4096;
diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c
index d1dc49193055..109ff04e1e8f 100644
--- a/tests/qtest/libqos/qgraph.c
+++ b/tests/qtest/libqos/qgraph.c
@@ -93,7 +93,7 @@ static void add_edge(const char *source, const char *dest,
     edge->type = type;
     edge->dest = g_strdup(dest);
     edge->edge_name = g_strdup(opts->edge_name ?: dest);
-    edge->arg = g_memdup(opts->arg, opts->size_arg);
+    edge->arg = g_memdup2(opts->arg, opts->size_arg);
 
     edge->before_cmd_line =
         opts->before_cmd_line ? g_strconcat(" ", opts->before_cmd_line, NULL) : NULL;
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 9/9] checkpatch: Do not allow deprecated g_memdup()
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (7 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 8/9] tests/qtest: Replace g_memdup() by g_memdup2() Laurent Vivier
@ 2021-12-17 20:10 ` Laurent Vivier
  2021-12-18  2:04 ` [PULL 0/9] Trivial branch for 7.0 patches Richard Henderson
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-12-17 20:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Eric Blake, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

g_memdup() is insecure and as been deprecated in GLib 2.68.
QEMU provides the safely equivalent g_memdup2() wrapper.

Do not allow more g_memdup() calls in the repository, provide
a hint to use g_memdup2().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210903174510.751630-29-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 scripts/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cb8eff233e06..5caa739db486 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2850,6 +2850,11 @@ sub process {
 			WARN("consider using g_path_get_$1() in preference to g_strdup($1())\n" . $herecurr);
 		}
 
+# enforce g_memdup2() over g_memdup()
+		if ($line =~ /\bg_memdup\s*\(/) {
+			ERROR("use g_memdup2() instead of unsafe g_memdup()\n" . $herecurr);
+		}
+
 # recommend qemu_strto* over strto* for numeric conversions
 		if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
 			ERROR("consider using qemu_$1 in preference to $1\n" . $herecurr);
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PULL 0/9] Trivial branch for 7.0 patches
  2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
                   ` (8 preceding siblings ...)
  2021-12-17 20:10 ` [PULL 9/9] checkpatch: Do not allow deprecated g_memdup() Laurent Vivier
@ 2021-12-18  2:04 ` Richard Henderson
  9 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2021-12-18  2:04 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: qemu-trivial

On 12/17/21 12:10 PM, Laurent Vivier wrote:
> The following changes since commit 29eb5c2c86f935b0e9700fad2ecfe8a32b011d57:
> 
>    Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2021-12-16 08:39:20 -0800)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/laurent_vivier/qemu.git tags/trivial-branch-for-7.0-pull-request
> 
> for you to fetch changes up to ce2ff9cccf0c5f123f9d1e3d5e4fc07d1c2c159d:
> 
>    checkpatch: Do not allow deprecated g_memdup() (2021-12-17 11:57:35 +0100)
> 
> ----------------------------------------------------------------
> Trivial patches pull request 20211217
> 
> ----------------------------------------------------------------
> 
> Leonardo Garcia (1):
>    hw/virtio/vhost: Fix typo in comment.
> 
> Philippe Mathieu-Daudé (7):
>    configure: Symlink binaries using .exe suffix with MinGW
>    target/i386/kvm: Replace use of __u32 type
>    qemu-keymap: Add license in generated files
>    hw/avr: Realize AVRCPU qdev object using qdev_realize()
>    glib-compat: Introduce g_memdup2() wrapper
>    tests/qtest: Replace g_memdup() by g_memdup2()
>    checkpatch: Do not allow deprecated g_memdup()
> 
> Zhang Chen (1):
>    docs/block-replication.txt: Fix replication top-id command demo
> 
>   configure                   |  2 +-
>   docs/block-replication.txt  |  2 +-
>   hw/avr/atmega.c             |  2 +-
>   hw/virtio/vhost.c           |  2 +-
>   include/glib-compat.h       | 37 +++++++++++++++++++++++++++++++++++++
>   qemu-keymap.c               |  1 +
>   scripts/checkpatch.pl       |  5 +++++
>   target/i386/kvm/kvm.c       |  2 +-
>   tests/qtest/libqos/ahci.c   |  6 +++---
>   tests/qtest/libqos/qgraph.c |  2 +-
>   10 files changed, 52 insertions(+), 9 deletions(-)

Applied, thanks.


r~


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-18  2:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 20:10 [PULL 0/9] Trivial branch for 7.0 patches Laurent Vivier
2021-12-17 20:10 ` [PULL 1/9] configure: Symlink binaries using .exe suffix with MinGW Laurent Vivier
2021-12-17 20:10 ` [PULL 2/9] target/i386/kvm: Replace use of __u32 type Laurent Vivier
2021-12-17 20:10 ` [PULL 3/9] qemu-keymap: Add license in generated files Laurent Vivier
2021-12-17 20:10 ` [PULL 4/9] hw/avr: Realize AVRCPU qdev object using qdev_realize() Laurent Vivier
2021-12-17 20:10 ` [PULL 5/9] hw/virtio/vhost: Fix typo in comment Laurent Vivier
2021-12-17 20:10 ` [PULL 6/9] docs/block-replication.txt: Fix replication top-id command demo Laurent Vivier
2021-12-17 20:10 ` [PULL 7/9] glib-compat: Introduce g_memdup2() wrapper Laurent Vivier
2021-12-17 20:10 ` [PULL 8/9] tests/qtest: Replace g_memdup() by g_memdup2() Laurent Vivier
2021-12-17 20:10 ` [PULL 9/9] checkpatch: Do not allow deprecated g_memdup() Laurent Vivier
2021-12-18  2:04 ` [PULL 0/9] Trivial branch for 7.0 patches Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.