[CRIU] [PATCH] restore: Explain types to min() helper
Pavel Emelyanov
xemul at parallels.com
Thu Nov 12 03:26:52 PST 2015
On 11/12/2015 02:20 PM, Cyrill Gorcunov wrote:
> On arm
>
> | CC crtools.o
> | In file included from arch/arm/include/asm/bitops.h:4:0,
> | from arch/arm/include/asm/types.h:9,
> | from include/proc_parse.h:5,
> | from include/ptrace.h:8,
> | from cr-restore.c:27:
> | cr-restore.c: In function 'restore_priv_vma_content':
> | include/compiler.h:60:17: error: comparison of distinct pointer types lacks a cast [-Werror]
> | (void) (&_min1 == &_min2); \
> |
>
> Reported-by: Pavel Emelyanov <xemul at parallels.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> cr-restore.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/cr-restore.c b/cr-restore.c
> index 2c00bff64a80..d070c80a778b 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -493,7 +493,8 @@ static int restore_priv_vma_content(void)
> * we have at most (vma->end - current_addr) bytes.
> */
>
> - nr = min(nr_pages - i, (vma->e->end - va) / PAGE_SIZE);
> + nr = min((unsigned long)(nr_pages - i),
> + (unsigned long)((vma->e->end - va) / PAGE_SIZE));
Maybe grab the min_t() helper from the kernel?
>
> ret = pr.read_pages(&pr, va, nr, p);
> if (ret < 0)
>
More information about the CRIU
mailing list