x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT [Linux 5.0]

x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT [Linux 5.0]

This Linux kernel change "x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT" is included in the Linux 5.0 release. This change is authored by Lan Tianyu <Tianyu.Lan [at] microsoft.com> on Mon Feb 25 22:31:14 2019 +0800. The commit for this change in Linux stable tree is 9cd05ad (patch).

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.

Fixes: cc4edae4b924 ("x86/hyper-v: Add HvFlushGuestAddressList hypercall support")
Signed-off-by: Lan Tianyu <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/x86/include/asm/hyperv-tlfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
index 705dafc..2bdbbbc 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -841,7 +841,7 @@ struct hv_guest_mapping_flush {
  * 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 {

Leave a Reply

Your email address will not be published. Required fields are marked *