[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH 5/8] libxl: Assert qmp_ev's state in qmp_ev_qemu_compare_version


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Fri, 23 Apr 2021 17:15:55 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 23 Apr 2021 16:16:18 +0000
  • Ironport-hdrordr: A9a23:iO0EZqut0LjoOZQ9DII56uer7skD9dV00zAX/kB9WHVpW+az/v rAoN0w0xjohDENHEw6kdebN6WaBV/a/5h54Y4eVI3SOzXOkm2uMY1k8M/e0yTtcheOj9J1+K 98f8FFaeHYIkN9ia/BjTWQM9Fl+9Wf9bDtuOG29QYOcShPS4VNqzh0ERyaFEoefngjObMcGI CH7sRK4xqMEE52Uu2BCnMIX/fOqrTw/fqMCyIuPBIp5BKDijml8tfBYn2l9ywTTi9VxvMa+X XF+jaJgJmLie2xyRPXygbogah+pd2J8Ld+Lf3JrsAULzn24zzYB7hcZw==
  • Ironport-sdr: o6XDtXjQNm2tlxCbQW/75Utq2npQ+oWMTBUrnheQn/YfNJENnS7atFefdkM18jkhZAv9YjglQ6 3NXdJ+C7IGJlWDZJJ/7aKVp/polQs+h/19wM5Xy6udvSYdUuCClzdnbcl7Sf/l8JAQGFCdz3Rb lCze5mVW7alNxhh2KK+Iusge+84RNuwA+5ybYMPMTsB73j3FU48AcDzhj1x6iqiV5RrX3dUoLU F5MERxXXvBIgkkjtb6yMAVo7Q7tyti8wsi7XFEdfGF7tR+JAbtDli/o3ucbBN0bTgujSTQqKma l5c=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

We are supposed to read the version information only when qmp_ev is in
state "Connected" (that correspond to state==qmp_state_connected),
assert it so that the function isn't used too early.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libs/light/libxl_qmp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libs/light/libxl_qmp.c b/tools/libs/light/libxl_qmp.c
index 9b638e6f5442..d0967c9f029f 100644
--- a/tools/libs/light/libxl_qmp.c
+++ b/tools/libs/light/libxl_qmp.c
@@ -292,6 +292,8 @@ static int qmp_handle_response(libxl__gc *gc, 
libxl__qmp_handler *qmp,
 static int qmp_ev_qemu_compare_version(libxl__ev_qmp *ev, int major,
                                        int minor, int micro)
 {
+    assert(ev->state == qmp_state_connected);
+
 #define CHECK_VERSION(level) do { \
     if (ev->qemu_version.level > (level)) return +1; \
     if (ev->qemu_version.level < (level)) return -1; \
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.