diff options
| -rw-r--r-- | arch/x86/xen/p2m.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 996ee2bf7bdb..c3e92912c3fb 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
| @@ -396,6 +396,7 @@ unsigned long __init xen_revector_p2m_tree(void) | |||
| 396 | unsigned long va_start; | 396 | unsigned long va_start; |
| 397 | unsigned long va_end; | 397 | unsigned long va_end; |
| 398 | unsigned long pfn; | 398 | unsigned long pfn; |
| 399 | unsigned long pfn_free = 0; | ||
| 399 | unsigned long *mfn_list = NULL; | 400 | unsigned long *mfn_list = NULL; |
| 400 | unsigned long size; | 401 | unsigned long size; |
| 401 | 402 | ||
| @@ -442,11 +443,18 @@ unsigned long __init xen_revector_p2m_tree(void) | |||
| 442 | if (mid_p >= (unsigned long *)va_start && mid_p <= (unsigned long *)va_end) { | 443 | if (mid_p >= (unsigned long *)va_start && mid_p <= (unsigned long *)va_end) { |
| 443 | unsigned long *new; | 444 | unsigned long *new; |
| 444 | 445 | ||
| 445 | new = &mfn_list[pfn]; | 446 | if (pfn_free > (size / sizeof(unsigned long))) { |
| 447 | WARN(1, "Only allocated for %ld pages, but we want %ld!\n", | ||
| 448 | size / sizeof(unsigned long), pfn_free); | ||
| 449 | return 0; | ||
| 450 | } | ||
| 451 | new = &mfn_list[pfn_free]; | ||
| 446 | 452 | ||
| 447 | copy_page(new, mid_p); | 453 | copy_page(new, mid_p); |
| 448 | p2m_top[topidx][mididx] = &mfn_list[pfn]; | 454 | p2m_top[topidx][mididx] = &mfn_list[pfn_free]; |
| 449 | p2m_top_mfn_p[topidx][mididx] = virt_to_mfn(&mfn_list[pfn]); | 455 | p2m_top_mfn_p[topidx][mididx] = virt_to_mfn(&mfn_list[pfn_free]); |
| 456 | |||
| 457 | pfn_free += P2M_PER_PAGE; | ||
| 450 | 458 | ||
| 451 | } | 459 | } |
| 452 | /* This should be the leafs allocated for identity from _brk. */ | 460 | /* This should be the leafs allocated for identity from _brk. */ |
