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

[libvirt] [PATCH] fix 1 << -1 at JOB_MASK macro



From: caoxinhua <caoxinhua huawei com>

when we start a vm, we call JOB_MASK(QEMU_JOB_NONE), then 1 << -1 will be execute. we fix it as return 0
---
 src/libxl/libxl_domain.h | 2 +-
 src/qemu/qemu_domain.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 3a3890b..dc40139 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -30,7 +30,7 @@
 # include "libxl_conf.h"
 # include "virchrdev.h"
 
-# define JOB_MASK(job)                  (1 << (job - 1))
+# define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
 # define DEFAULT_JOB_MASK               \
     (JOB_MASK(LIBXL_JOB_DESTROY) |      \
      JOB_MASK(LIBXL_JOB_ABORT))
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 365b23c..6750215 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -51,7 +51,7 @@
 #  define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
 # endif
 
-# define JOB_MASK(job)                  (1 << (job - 1))
+# define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
 # define QEMU_JOB_DEFAULT_MASK          \
     (JOB_MASK(QEMU_JOB_QUERY) |         \
      JOB_MASK(QEMU_JOB_DESTROY) |       \
-- 
2.8.3



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