qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] replace functions which are only available in glib-2.24
@ 2018-05-15  5:59 Olaf Hering
  2018-05-15  6:04 ` no-reply
  2018-05-15  7:42 ` Markus Armbruster
  0 siblings, 2 replies; 6+ messages in thread
From: Olaf Hering @ 2018-05-15  5:59 UTC (permalink / raw)
  To: qemu-trivial
  Cc: Olaf Hering, Fam Zheng, Stefan Hajnoczi, Paolo Bonzini,
	open list:All patches CC here

Currently the minimal supported version of glib is 2.22.
Since testing is done with a glib that claims to be 2.22, but in fact
has APIs from newer version of glib, this bug was not caught during
submit of the patch referenced below.

Replace g_realloc_n, which is available only since 2.24, with g_renew.

Fixes commit 418026ca43 ("util: Introduce vfio helpers")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---

This must go into stable-2.12.


 util/vfio-helpers.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 006674c916..5fd4f5f212 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -522,8 +522,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState *s,
 
     assert(index >= 0);
     s->nr_mappings++;
-    s->mappings = g_realloc_n(s->mappings, sizeof(s->mappings[0]),
-                              s->nr_mappings);
+    s->mappings = g_renew(IOVAMapping *, s->mappings, s->nr_mappings);
     insert = &s->mappings[index];
     shift = s->nr_mappings - index - 1;
     if (shift) {
@@ -577,8 +576,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping,
     memmove(mapping, &s->mappings[index + 1],
             sizeof(s->mappings[0]) * (s->nr_mappings - index - 1));
     s->nr_mappings--;
-    s->mappings = g_realloc_n(s->mappings, sizeof(s->mappings[0]),
-                              s->nr_mappings);
+    s->mappings = g_renew(IOVAMapping *, s->mappings, s->nr_mappings);
 }
 
 /* Check if the mapping list is (ascending) ordered. */

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

end of thread, other threads:[~2018-05-15 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-15  5:59 [Qemu-devel] [PATCH] replace functions which are only available in glib-2.24 Olaf Hering
2018-05-15  6:04 ` no-reply
2018-05-15  6:28   ` Olaf Hering
2018-05-15  7:42 ` Markus Armbruster
2018-05-15  8:41   ` Paolo Bonzini
2018-05-15 13:38     ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).