Skip to contentSkip to conversation

x86/Hyper-V: Fix definition HV_MAX_FLUSH_REP_COUNT

PATCH New [email protected] 2 participants 2 messages Feb 25, 2019 – Feb 28, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/Hyper-V: Fix definition HV_MAX_FLUSH_REP_COUNT

From: Lan Tianyu <[email protected]>

The max flush rep count of HvFlushGuestPhysicalAddressList hypercall is equal with how many entries of union hv_gpa_page_range can be populated into the input parameter page. The origin code lacks parenthesis around PAGE_SIZE - 2 * sizeof(u64). This patch is to fix it.

Fixes cc4edae4b924 ("x86/hyper-v: Add HvFlushGuestAddressList hypercall support")

---
Change since v1
- Update change log

 arch/x86/include/asm/hyperv-tlfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/hyperv-tlfs.h +1 -1
index 705dafc2d11a..2bdbbbcfa393 100644
@@ -841,7 +841,7 @@ union hv_gpa_page_range {
  * count is equal with how many entries of union hv_gpa_page_range can
  * be populated into the input parameter page.
  */
-#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) /	\
+#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) /	\
 				sizeof(union hv_gpa_page_range))
 
 struct hv_guest_mapping_flush_list {
Signature · 1 line
2.14.4
#1 lore raw

[tip:x86/urgent] x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT

x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT
Commit-ID:  9cd05ad2910b55238e3c720c99ad896dc538301b
Gitweb:     https://git.kernel.org/tip/9cd05ad2910b55238e3c720c99ad896dc538301b
Author:     Lan Tianyu <[email protected]>
AuthorDate: Mon, 25 Feb 2019 22:31:14 +0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 28 Feb 2019 11:58:29 +0100

x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT

The max flush rep count of HvFlushGuestPhysicalAddressList hypercall is equal with how many entries of union hv_gpa_page_range can be populated into the input parameter page.

The code lacks parenthesis around PAGE_SIZE - 2 * sizeof(u64) which results in bogus computations. Add them.

---
 arch/x86/include/asm/hyperv-tlfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/hyperv-tlfs.h +1 -1
index 705dafc2d11a..2bdbbbcfa393 100644
@@ -841,7 +841,7 @@ union hv_gpa_page_range {
  * count is equal with how many entries of union hv_gpa_page_range can
  * be populated into the input parameter page.
  */
-#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) /	\
+#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) /	\
 				sizeof(union hv_gpa_page_range))
 
 struct hv_guest_mapping_flush_list {