mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
page-xfer: fix incompatible pointer type on armv7
page_pipe_read() expects an 'unsigned long *', but pi->nr_pages is u64. On 32-bit platforms (e.g., armv7), passing &pi->nr_pages directly causes a compiler error. To fix this we introduce a temporary variable and copy the result back to pi->nr_pages. Fixes: #2756 Suggested-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
6549697c0f
commit
cc7f457b3c
2 changed files with 8 additions and 3 deletions
|
|
@ -1139,13 +1139,17 @@ static int page_server_get_pages(int sk, struct page_server_iov *pi)
|
|||
{
|
||||
struct pstree_item *item;
|
||||
struct page_pipe *pp;
|
||||
unsigned long len;
|
||||
unsigned long len, nr_pages;
|
||||
int ret;
|
||||
|
||||
item = pstree_item_by_virt(pi->dst_id);
|
||||
pp = dmpi(item)->mem_pp;
|
||||
|
||||
ret = page_pipe_read(pp, &pipe_read_dest, pi->vaddr, &pi->nr_pages, PPB_LAZY);
|
||||
/* page_pipe_read() uses 'unsigned long *' but pi->nr_pages is u64.
|
||||
* Use a temporary variable to fix the incompatible pointer type
|
||||
* on 32-bit platforms (e.g. armv7). */
|
||||
nr_pages = pi->nr_pages;
|
||||
ret = page_pipe_read(pp, &pipe_read_dest, pi->vaddr, &nr_pages, PPB_LAZY);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -1154,6 +1158,7 @@ static int page_server_get_pages(int sk, struct page_server_iov *pi)
|
|||
* .dst_id all remain intact.
|
||||
*/
|
||||
|
||||
pi->nr_pages = nr_pages;
|
||||
if (pi->nr_pages == 0) {
|
||||
pr_debug("no iovs found, zero pages\n");
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static int seek_pagemap(struct page_read *pr, unsigned long vaddr)
|
|||
static inline void pagemap_bound_check(PagemapEntry *pe, unsigned long vaddr, unsigned long int nr)
|
||||
{
|
||||
if (vaddr < pe->vaddr || (vaddr - pe->vaddr) / PAGE_SIZE + nr > pe->nr_pages) {
|
||||
pr_err("Page read err %" PRIx64 ":%lx vs %lx:%lx\n", pe->vaddr, pe->nr_pages, vaddr, nr);
|
||||
pr_err("Page read err %" PRIx64 ":%" PRIx64 " vs %lx:%lx\n", pe->vaddr, pe->nr_pages, vaddr, nr);
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue