[CRIU] [PATCH 16/20] multiarch: fixed all pointer to integer conversion warnings.

alekskartashov at parallels.com alekskartashov at parallels.com
Wed Dec 12 08:34:26 EST 2012


From: Alexander Kartashov <alekskartashov at parallels.com>

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/arm/Makefile.inc       |    2 +-
 arch/arm/restorer_private.h |    2 +-
 cr-dump.c                   |    4 ++--
 cr-restore.c                |   12 ++++++------
 include/types.h             |    2 ++
 parasite-syscall.c          |    4 ++--
 pie/log-simple.c            |    2 ++
 pie/parasite.c              |    4 ++--
 pie/restorer.c              |   10 +++++-----
 9 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/arch/arm/Makefile.inc b/arch/arm/Makefile.inc
index 5613d87..c635542 100644
--- a/arch/arm/Makefile.inc
+++ b/arch/arm/Makefile.inc
@@ -6,4 +6,4 @@ LD		:= $(GCC_PREFIX)ld
 OBJCOPY := $(GCC_PREFIX)objcopy
 LDARCH	:= arm
 
-CFLAGS += -Wno-error=int-to-pointer-cast -Wno-error=pointer-to-int-cast -march=armv7-a
+CFLAGS += -march=armv7-a
diff --git a/arch/arm/restorer_private.h b/arch/arm/restorer_private.h
index b5c9ecd..0b11a7f 100644
--- a/arch/arm/restorer_private.h
+++ b/arch/arm/restorer_private.h
@@ -149,7 +149,7 @@ static int restore_gpregs(struct rt_sigframe *f, UserArmRegsEntry *r) {
 }
 
 static int restore_fpregs(struct rt_sigframe *f, UserFPState *fpstate) {
-	struct aux_sigframe *aux = &f->sig.uc.uc_regspace;
+	struct aux_sigframe *aux = (struct aux_sigframe*)&f->sig.uc.uc_regspace;
 
 	aux->vfp.magic = VFP_MAGIC;
 	aux->vfp.size = VFP_STORAGE_SIZE;
diff --git a/cr-dump.c b/cr-dump.c
index e09dd62..47ca74c 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -613,7 +613,7 @@ static int get_task_futex_robust_list(pid_t pid, ThreadCoreEntry *info)
 		return -1;
 	}
 
-	info->futex_rla		= (u64)head;
+	info->futex_rla		= (u64)P(head);
 	info->futex_rla_len	= (u32)len;
 
 	return 0;
@@ -1202,7 +1202,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
 
 	pr_info("%d: virt_pid=%d tid_address=%p sig_blocked=0x%"PRIx64"\n", pid,
 			tid->virt, taddr, core->thread_core->blk_sigset);
-	CORE_THREAD_INFO(core)->clear_tid_addr = (u64) taddr;
+	CORE_THREAD_INFO(core)->clear_tid_addr = P(taddr);
 
 	ret = dump_sched_info(pid, core->thread_core);
 	if (ret)
diff --git a/cr-restore.c b/cr-restore.c
index 995656e..694c777 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -214,7 +214,7 @@ static int map_private_vma(pid_t pid, struct vma_area *vma, void *tgt_addr,
 		    p->vma.start == vma->vma.start) {
 			pr_info("COW 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" vma\n",
 				vma->vma.start, vma->vma.end, vma->vma.pgoff);
-			paddr = (void *) vma_premmaped_start(&p->vma);
+			paddr = (void *)P(vma_premmaped_start(&p->vma));
 			break;
 		}
 
@@ -306,8 +306,8 @@ static int restore_priv_vma_content(pid_t pid)
 			return -1;
 		}
 
-		p = (void *) (va - vma->vma.start +
-					vma_premmaped_start(&vma->vma));
+		p = (void *) (va - P(vma->vma.start) +
+					P(vma_premmaped_start(&vma->vma)));
 		if (memcmp(p, buf, PAGE_SIZE) == 0) {
 			nr_shared++;
 			continue;
@@ -321,7 +321,7 @@ static int restore_priv_vma_content(pid_t pid)
 	/* Remove pages, which were not shared with a child */
 	list_for_each_entry(vma, &rst_vma_list, list) {
 		unsigned long size, i = 0;
-		void *addr = (void *) vma_premmaped_start(&vma->vma);
+		void *addr = (void *) P(vma_premmaped_start(&vma->vma));
 
 		if (vma->ppage_bitmap == NULL)
 			continue;
@@ -526,9 +526,9 @@ static int prepare_sigactions(int pid)
 		if (ret < 0)
 			break;
 
-		ASSIGN_TYPED(act.rt_sa_handler, e->sigaction);
+		ASSIGN_TYPED(act.rt_sa_handler, P(e->sigaction));
 		ASSIGN_TYPED(act.rt_sa_flags, e->flags);
-		ASSIGN_TYPED(act.rt_sa_restorer, e->restorer);
+		ASSIGN_TYPED(act.rt_sa_restorer, P(e->restorer));
 		ASSIGN_TYPED(act.rt_sa_mask.sig[0], e->mask);
 
 		sa_entry__free_unpacked(e, NULL);
diff --git a/include/types.h b/include/types.h
index 40a5f78..fb4740f 100644
--- a/include/types.h
+++ b/include/types.h
@@ -181,4 +181,6 @@ typedef struct {
 # define MADV_DONTDUMP 16
 #endif
 
+#define P(i) ((size_t)i)
+
 #endif /* CR_TYPES_H_ */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index ca94c91..1abd572 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -407,9 +407,9 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
 		if (sig == SIGSTOP || sig == SIGKILL)
 			continue;
 
-		ASSIGN_TYPED(se.sigaction, args->sas[i].rt_sa_handler);
+		ASSIGN_TYPED(se.sigaction, P(args->sas[i].rt_sa_handler));
 		ASSIGN_TYPED(se.flags, args->sas[i].rt_sa_flags);
-		ASSIGN_TYPED(se.restorer, args->sas[i].rt_sa_restorer);
+		ASSIGN_TYPED(se.restorer, P(args->sas[i].rt_sa_restorer));
 		ASSIGN_TYPED(se.mask, args->sas[i].rt_sa_mask.sig[0]);
 
 		if (pb_write_one(fd, &se, PB_SIGACT) < 0)
diff --git a/pie/log-simple.c b/pie/log-simple.c
index eb940c1..58bc6c5 100644
--- a/pie/log-simple.c
+++ b/pie/log-simple.c
@@ -136,6 +136,7 @@ static void print_hex_l(unsigned long num)
 	hexdigit(num >> 24, &buf[11], &z);
 	hexdigit(num >> 28, &buf[10], &z);
 
+#ifdef CONFIG_X86
 	hexdigit(num >> 32, &buf[9], &z);
 	hexdigit(num >> 36, &buf[8], &z);
 	hexdigit(num >> 40, &buf[7], &z);
@@ -144,6 +145,7 @@ static void print_hex_l(unsigned long num)
 	hexdigit(num >> 52, &buf[4], &z);
 	hexdigit(num >> 56, &buf[3], &z);
 	hexdigit(num >> 60, &buf[2], &z);
+#endif
 
 	z -= 2;
 	z[0] = '0';
diff --git a/pie/parasite.c b/pie/parasite.c
index 14bb28e..0aece73 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -179,7 +179,7 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 	if (!(args->vma_entry.prot & PROT_READ)) {
 		prot_old = (unsigned long)args->vma_entry.prot;
 		prot_new = prot_old | PROT_READ;
-		ret = sys_mprotect((void *)args->vma_entry.start,
+		ret = sys_mprotect((void *)P(args->vma_entry.start),
 				   (unsigned long)vma_entry_len(&args->vma_entry),
 				   prot_new);
 		if (ret) {
@@ -215,7 +215,7 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 	 * Don't left pages readable if they were not.
 	 */
 	if (prot_old != prot_new) {
-		ret = sys_mprotect((void *)args->vma_entry.start,
+		ret = sys_mprotect((void *)P(args->vma_entry.start),
 				   (unsigned long)vma_entry_len(&args->vma_entry),
 				   prot_old);
 		if (ret) {
diff --git a/pie/restorer.c b/pie/restorer.c
index ba8451f..874f8d0 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -149,10 +149,10 @@ static int restore_thread_common(struct rt_sigframe *sigframe,
 {
 	int ret;
 
-	sys_set_tid_address((int *)(int32_t)args->clear_tid_addr);
+	sys_set_tid_address((int *)P(args->clear_tid_addr));
 
 	if (args->has_futex) {
-		if (sys_set_robust_list((void *)args->futex_rla, args->futex_rla_len)) {
+		if (sys_set_robust_list((void *)P(args->futex_rla), args->futex_rla_len)) {
 			pr_err("Robust list err\n");
 			return -1;
 		}
@@ -238,7 +238,7 @@ static u64 restore_mapping(const VmaEntry *vma_entry)
 	u64 addr;
 
 	if (vma_entry_is(vma_entry, VMA_AREA_SYSVIPC))
-		return sys_shmat(vma_entry->fd, (void *)vma_entry->start,
+		return sys_shmat(vma_entry->fd, (void *)P(vma_entry->start),
 				 (vma_entry->prot & PROT_WRITE) ? 0 : SHM_RDONLY);
 
 	/*
@@ -262,7 +262,7 @@ static u64 restore_mapping(const VmaEntry *vma_entry)
 	 * writable since we're going to restore page
 	 * contents.
 	 */
-	addr = sys_mmap((void *)vma_entry->start,
+	addr = sys_mmap((void *)P(vma_entry->start),
 			vma_entry_len(vma_entry),
 			prot, flags,
 			vma_entry->fd,
@@ -510,7 +510,7 @@ long __export_restore_task(struct task_restore_core_args *args)
 		if (vma_entry->prot & PROT_WRITE)
 			continue;
 
-		sys_mprotect((void *)vma_entry->start,
+		sys_mprotect((void *)P(vma_entry->start),
 			     vma_entry_len(vma_entry),
 			     vma_entry->prot);
 	}
-- 
1.7.9.5



More information about the CRIU mailing list