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

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

 



From: caoxinhua <caoxinhua@xxxxxxxxxx>

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


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux