]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Use bitwise AND operation while fetching current IOPL.
authorOliver Kurth <okurth@vmware.com>
Fri, 5 Oct 2018 20:55:27 +0000 (13:55 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 5 Oct 2018 20:55:27 +0000 (13:55 -0700)
Iopl_Get() was using logical AND operation which could result
in wrong IOPL value. We should be using bitwise AND instead.

open-vm-tools/lib/include/ioplGet.h

index bcecf9bf2d85f07a63f39465fc079bc3176602dd..2ebe8aad93641783a6e733882b2781612ba4e3c6 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2012-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2012-2018 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -33,7 +33,7 @@
 extern "C" {
 #endif
 
-#define Iopl_Get() ((GetCallerEFlags() >> EFLAGS_IOPL_SHIFT) && 0x3)
+#define Iopl_Get() ((GetCallerEFlags() >> EFLAGS_IOPL_SHIFT) & 0x3)
 
 #if defined(__cplusplus)
 }  // extern "C"