diff options
Diffstat (limited to 'drivers/char/hmm_dmirror.c')
-rw-r--r-- | drivers/char/hmm_dmirror.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/char/hmm_dmirror.c b/drivers/char/hmm_dmirror.c index 3fa1fcda5da7..308eaae117a2 100644 --- a/drivers/char/hmm_dmirror.c +++ b/drivers/char/hmm_dmirror.c @@ -737,7 +737,7 @@ static struct page *dummy_device_alloc_page(struct dmirror_device *mdevice) * This is a fake device so we alloc real system memory to fake * our device memory */ - rpage = alloc_page(GFP_HIGHUSER); + rpage = alloc_page(GFP_HIGHUSER | __GFP_ZERO); if (!rpage) return NULL; @@ -793,9 +793,13 @@ static void dummy_migrate_alloc_and_copy(struct vm_area_struct *vma, *dst_pfns = 0; - if (!spage || !(*src_pfns & MIGRATE_PFN_MIGRATE)) + if (!spage && !(*src_pfns & MIGRATE_PFN_MIGRATE)) + continue; + + if (spage && !(*src_pfns & MIGRATE_PFN_MIGRATE)) continue; - if (*src_pfns & MIGRATE_PFN_DEVICE) { + + if (spage && (*src_pfns & MIGRATE_PFN_DEVICE)) { if (!dummy_device_is_mine(mdevice, spage)) { continue; } @@ -810,7 +814,8 @@ static void dummy_migrate_alloc_and_copy(struct vm_area_struct *vma, rpage = (void *)hmm_devmem_page_get_drvdata(dpage); - copy_highpage(rpage, spage); + if (spage) + copy_highpage(rpage, spage); *dst_pfns = migrate_pfn(page_to_pfn(dpage)) | MIGRATE_PFN_DEVICE | MIGRATE_PFN_LOCKED; |