* [Qemu-devel] [PULL 1/2] numa-test: fix query-cpus leaks
2017-05-30 19:11 [Qemu-devel] [PULL 0/2] NUMA fixes, 2017-05-30 Eduardo Habkost
@ 2017-05-30 19:11 ` Eduardo Habkost
2017-05-30 19:11 ` [Qemu-devel] [PULL 2/2] numa: Fix format string for "Invalid node" message Eduardo Habkost
2017-06-01 11:06 ` [Qemu-devel] [PULL 0/2] NUMA fixes, 2017-05-30 Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2017-05-30 19:11 UTC (permalink / raw)
To: Peter Maydell; +Cc: Igor Mammedov, qemu-devel, Marc-André Lureau
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Fix test leaks introduced in commit 2941020a476.
(and small extra space removed)
Spotted by ASAN.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170526110456.32004-1-marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
tests/numa-test.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/numa-test.c b/tests/numa-test.c
index c3475d6d5e..3f636840b1 100644
--- a/tests/numa-test.c
+++ b/tests/numa-test.c
@@ -92,7 +92,7 @@ static QList *get_cpus(QDict **resp)
*resp = qmp("{ 'execute': 'query-cpus' }");
g_assert(*resp);
g_assert(qdict_haskey(*resp, "return"));
- return qdict_get_qlist(*resp, "return");
+ return qdict_get_qlist(*resp, "return");
}
static void test_query_cpus(const void *data)
@@ -100,7 +100,7 @@ static void test_query_cpus(const void *data)
char *cli;
QDict *resp;
QList *cpus;
- const QObject *e;
+ QObject *e;
cli = make_cli(data, "-smp 8 -numa node,cpus=0-3 -numa node,cpus=4-7");
qtest_start(cli);
@@ -124,6 +124,7 @@ static void test_query_cpus(const void *data)
} else {
g_assert_cmpint(node, ==, 1);
}
+ qobject_decref(e);
}
QDECREF(resp);
@@ -136,7 +137,7 @@ static void pc_numa_cpu(const void *data)
char *cli;
QDict *resp;
QList *cpus;
- const QObject *e;
+ QObject *e;
cli = make_cli(data, "-cpu pentium -smp 8,sockets=2,cores=2,threads=2 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -176,6 +177,7 @@ static void pc_numa_cpu(const void *data)
} else {
g_assert(false);
}
+ qobject_decref(e);
}
QDECREF(resp);
@@ -188,7 +190,7 @@ static void spapr_numa_cpu(const void *data)
char *cli;
QDict *resp;
QList *cpus;
- const QObject *e;
+ QObject *e;
cli = make_cli(data, "-smp 4,cores=4 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -220,6 +222,7 @@ static void spapr_numa_cpu(const void *data)
} else {
g_assert(false);
}
+ qobject_decref(e);
}
QDECREF(resp);
@@ -232,7 +235,7 @@ static void aarch64_numa_cpu(const void *data)
char *cli;
QDict *resp;
QList *cpus;
- const QObject *e;
+ QObject *e;
cli = make_cli(data, "-smp 2 "
"-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -262,6 +265,7 @@ static void aarch64_numa_cpu(const void *data)
} else {
g_assert(false);
}
+ qobject_decref(e);
}
QDECREF(resp);
--
2.11.0.259.g40922b1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PULL 2/2] numa: Fix format string for "Invalid node" message
2017-05-30 19:11 [Qemu-devel] [PULL 0/2] NUMA fixes, 2017-05-30 Eduardo Habkost
2017-05-30 19:11 ` [Qemu-devel] [PULL 1/2] numa-test: fix query-cpus leaks Eduardo Habkost
@ 2017-05-30 19:11 ` Eduardo Habkost
2017-06-01 11:06 ` [Qemu-devel] [PULL 0/2] NUMA fixes, 2017-05-30 Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2017-05-30 19:11 UTC (permalink / raw)
To: Peter Maydell; +Cc: Igor Mammedov, qemu-devel
Some compilers complain about the PRIu16 format string with the
MAX(src, dst) and MAX_NODES arguments. Example output from Apple LLVM
version 7.3.0 (clang-703.0.31):
numa.c:236:20: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
MAX(src, dst), MAX_NODES);
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/qapi/error.h:163:35: note: expanded from macro 'error_setg'
(fmt), ## __VA_ARGS__)
^~~~~~~~~~~
glib/2.52.2/include/glib-2.0/glib/gmacros.h:288:20: note: expanded from macro 'MAX'
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
^~~~~~~~~~~~~~~~~~~~~~~~~
numa.c:236:35: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
MAX(src, dst), MAX_NODES);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
include/qapi/error.h:163:35: note: expanded from macro 'error_setg'
(fmt), ## __VA_ARGS__)
^~~~~~~~~~~
include/sysemu/sysemu.h:165:19: note: expanded from macro 'MAX_NODES'
#define MAX_NODES 128
^~~
MAX(src, dst) promotes the src and dst arguments to int, and MAX_NODES
is an int. Use %d to silence those warnings.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170530184013.31044-1-ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
numa.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/numa.c b/numa.c
index ca731455e9..be50c62aa9 100644
--- a/numa.c
+++ b/numa.c
@@ -231,8 +231,7 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
if (src >= MAX_NODES || dst >= MAX_NODES) {
error_setg(errp,
- "Invalid node %" PRIu16
- ", max possible could be %" PRIu16,
+ "Invalid node %d, max possible could be %d",
MAX(src, dst), MAX_NODES);
return;
}
--
2.11.0.259.g40922b1
^ permalink raw reply related [flat|nested] 4+ messages in thread