Commit cc3a3c47 authored by Pavel Emelyanov's avatar Pavel Emelyanov

dump: Fix one-page mapping dump

The iov array for 1-page mapping would be zero. Fix this silly mistake.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 39402af7
...@@ -493,7 +493,7 @@ static unsigned int vmas_pagemap_size(struct vm_area_list *vmas) ...@@ -493,7 +493,7 @@ static unsigned int vmas_pagemap_size(struct vm_area_list *vmas)
*/ */
return sizeof(struct parasite_dump_pages_args) + return sizeof(struct parasite_dump_pages_args) +
vmas->priv_size * sizeof(struct iovec) / 2; (vmas->priv_size + 1) * sizeof(struct iovec) / 2;
} }
#define PME_PRESENT (1ULL << 63) #define PME_PRESENT (1ULL << 63)
......
...@@ -334,11 +334,11 @@ static int dump_one_shmem(struct shmem_info_dump *si) ...@@ -334,11 +334,11 @@ static int dump_one_shmem(struct shmem_info_dump *si)
if (err) if (err)
goto err_unmap; goto err_unmap;
iovs = xmalloc((nrpages / 2) * sizeof(struct iovec)); iovs = xmalloc(((nrpages + 1) / 2) * sizeof(struct iovec));
if (!iovs) if (!iovs)
goto err_unmap; goto err_unmap;
pp = create_page_pipe(nrpages / 2, iovs); pp = create_page_pipe((nrpages + 1) / 2, iovs);
if (!pp) if (!pp)
goto err_iovs; goto err_iovs;
......
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