diff mbox

[MINOR,FIXES,1/2] mm: fix memory cleanup

Message ID 1487328466-19180-2-git-send-email-nmanthey@amazon.com (mailing list archive)
State New, archived
Headers show

Commit Message

Norbert Manthey Feb. 17, 2017, 10:47 a.m. UTC
During destroying the m2p mapping, the loop variable was always incremented
by one, as the current version used a compare operator on the left hand side,
which always evaluated to true, i.e.

i += 1UL < (L2_PAGETABLE_SHIFT - 2)

The fix increments the value of the variable by the actual page size by
using the shift operator instead.

Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
---
 xen/arch/x86/x86_64/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper Feb. 17, 2017, 11:29 a.m. UTC | #1
On 17/02/17 10:47, Norbert Manthey wrote:
> During destroying the m2p mapping, the loop variable was always incremented
> by one, as the current version used a compare operator on the left hand side,
> which always evaluated to true, i.e.
>
> i += 1UL < (L2_PAGETABLE_SHIFT - 2)
>
> The fix increments the value of the variable by the actual page size by
> using the shift operator instead.
>
> Signed-off-by: Norbert Manthey <nmanthey@amazon.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 9ead02e..52f2bd5 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -251,7 +251,7 @@  static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info)
             }
         }
 
-        i += 1UL < (L2_PAGETABLE_SHIFT - 2);
+        i += 1UL << (L2_PAGETABLE_SHIFT - 2);
     }
 
     return;