[CRIU] [PATCH] pagemap: Use ssize_t type in read_local_page

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Aug 13 17:10:39 MSK 2018


On Fri, Aug 10, 2018 at 05:58:11PM +0300, Cyrill Gorcunov wrote:
> Integer is too small for big memory slabs.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
>  criu/pagemap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/pagemap.c b/criu/pagemap.c
> index 227db6bffe3a..06c470a7fed1 100644
> --- a/criu/pagemap.c
> +++ b/criu/pagemap.c
> @@ -244,7 +244,7 @@ static int read_local_page(struct page_read *pr, unsigned long vaddr,
>  			   unsigned long len, void *buf)
>  {
>  	int fd = img_raw_fd(pr->pi);
> -	int ret;
> +	ssize_t ret;

I think process_async_reads() should also use ssize_t to be on the safe
size :)
 
>  	/*
>  	 * Flush any pending async requests if any not to break the
> @@ -256,7 +256,7 @@ static int read_local_page(struct page_read *pr, unsigned long vaddr,
>  	pr_debug("\tpr%lu-%u Read page from self %lx/%"PRIx64"\n", pr->img_id, pr->id, pr->cvaddr, pr->pi_off);
>  	ret = pread(fd, buf, len, pr->pi_off);
>  	if (ret != len) {
> -		pr_perror("Can't read mapping page %d", ret);
> +		pr_perror("Can't read mapping page %zd", ret);
>  		return -1;
>  	}
> 
> -- 
> 2.14.4
-- 
Sincerely yours,
Mike.



More information about the CRIU mailing list