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 197d2f8bcdbc..c8b1aa11c871 100644 --- a/drivers/char/hmm_dmirror.c +++ b/drivers/char/hmm_dmirror.c @@ -738,7 +738,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; @@ -794,9 +794,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; } @@ -811,7 +815,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; |