[CRIU] [PATCH] restore: Explain types to min() helper

Cyrill Gorcunov gorcunov at openvz.org
Thu Nov 12 03:20:19 PST 2015


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));
 
 				ret = pr.read_pages(&pr, va, nr, p);
 				if (ret < 0)
-- 
2.4.3



More information about the CRIU mailing list