Commit 0432523f authored by Jan Beulich's avatar Jan Beulich Committed by Juergen Gross

xen/privcmd: replace kcalloc() by kvcalloc() when allocating empty pages

Osstest has been suffering test failures for a little while from order-4
allocation failures, resulting from alloc_empty_pages() calling
kcalloc(). As there's no need for physically contiguous space here,
switch to kvcalloc().
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/6d698901-98a4-05be-c421-bcd0713f5335@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
parent 0594c581
...@@ -420,7 +420,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs) ...@@ -420,7 +420,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs)
int rc; int rc;
struct page **pages; struct page **pages;
pages = kcalloc(numpgs, sizeof(pages[0]), GFP_KERNEL); pages = kvcalloc(numpgs, sizeof(pages[0]), GFP_KERNEL);
if (pages == NULL) if (pages == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -428,7 +428,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs) ...@@ -428,7 +428,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs)
if (rc != 0) { if (rc != 0) {
pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__, pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__,
numpgs, rc); numpgs, rc);
kfree(pages); kvfree(pages);
return -ENOMEM; return -ENOMEM;
} }
BUG_ON(vma->vm_private_data != NULL); BUG_ON(vma->vm_private_data != NULL);
...@@ -912,7 +912,7 @@ static void privcmd_close(struct vm_area_struct *vma) ...@@ -912,7 +912,7 @@ static void privcmd_close(struct vm_area_struct *vma)
else else
pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n", pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n",
numpgs, rc); numpgs, rc);
kfree(pages); kvfree(pages);
} }
static vm_fault_t privcmd_fault(struct vm_fault *vmf) static vm_fault_t privcmd_fault(struct vm_fault *vmf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment