[CRIU] [PATCH 14/23] cr: introduced the macro P() to convert an integer to unsigned long

Alexander Kartashov alekskartashov at parallels.com
Mon Jan 14 02:25:56 EST 2013


This patch prevents a lot of format string warnings on ARM.

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/x86/include/asm/types.h |    2 ++
 cr-dump.c                    |    2 +-
 cr-restore.c                 |   20 ++++++++++----------
 cr-show.c                    |   18 +++++++++---------
 eventfd.c                    |    2 +-
 eventpoll.c                  |    2 +-
 files-reg.c                  |    2 +-
 inotify.c                    |    8 ++++----
 ipc_ns.c                     |    4 ++--
 parasite-syscall.c           |    8 ++++----
 pie/parasite.c               |    4 ++--
 pie/restorer.c               |   20 ++++++++++----------
 pipes.c                      |    2 +-
 proc_parse.c                 |    8 ++++----
 shmem.c                      |   10 +++++-----
 sk-inet.c                    |    4 ++--
 sk-packet.c                  |    4 ++--
 util.c                       |   13 +++++++------
 18 files changed, 68 insertions(+), 65 deletions(-)

diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 4a02a93..a3cdf3e 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -274,4 +274,6 @@ typedef struct {
 
 #define TI_SP(core) ((core)->thread_info->gpregs->sp)
 
+#define P(i) i
+
 #endif /* __CR_ASM_TYPES_H__ */
diff --git a/cr-dump.c b/cr-dump.c
index 23744e4..8379c76 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -656,7 +656,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;
diff --git a/cr-restore.c b/cr-restore.c
index 36d67e6..1d23d3e 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -216,8 +216,8 @@ static int map_private_vma(pid_t pid, struct vma_area *vma, void *tgt_addr,
 		if (p->vma.end == vma->vma.end &&
 		    p->vma.start == vma->vma.start) {
 			pr_info("COW 0x%016lx-0x%016lx 0x%016lx vma\n",
-				vma->vma.start, vma->vma.end, vma->vma.pgoff);
-			paddr = (void *) vma_premmaped_start(&p->vma);
+				P(vma->vma.start), P(vma->vma.end), P(vma->vma.pgoff));
+			paddr = (void *)P(vma_premmaped_start(&p->vma));
 			break;
 		}
 
@@ -227,7 +227,7 @@ static int map_private_vma(pid_t pid, struct vma_area *vma, void *tgt_addr,
 
 	if (paddr == NULL) {
 		pr_info("Map 0x%016lx-0x%016lx 0x%016lx vma\n",
-			vma->vma.start, vma->vma.end, vma->vma.pgoff);
+			P(vma->vma.start), P(vma->vma.end), P(vma->vma.pgoff));
 
 		addr = mmap(tgt_addr, vma_entry_len(&vma->vma),
 				vma->vma.prot | PROT_WRITE,
@@ -309,8 +309,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;
@@ -324,7 +324,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;
@@ -473,8 +473,8 @@ static int open_vmas(int pid)
 			continue;
 
 		pr_info("Opening 0x%016lx-0x%016lx 0x%016lx (%x) vma\n",
-				vma->vma.start, vma->vma.end,
-				vma->vma.pgoff, vma->vma.status);
+				P(vma->vma.start), P(vma->vma.end),
+				P(vma->vma.pgoff), vma->vma.status);
 
 		if (vma_entry_is(&vma->vma, VMA_AREA_SYSVIPC))
 			ret = vma->vma.shmid;
@@ -529,9 +529,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/cr-show.c b/cr-show.c
index 8ad2361..975f8ba 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -232,7 +232,7 @@ void show_pages(int fd_pages, struct cr_options *o)
 					goto out;
 				}
 
-				pr_msg("0x%16lx ", e.va);
+				pr_msg("0x%16lx ", P(e.va));
 			}
 			pr_msg("\n");
 		}
@@ -310,18 +310,18 @@ static void show_core_regs(UserX86RegsEntry *regs)
 	       "%8s: 0x%-16lx "		\
 	       "%8s: 0x%-16lx "		\
 	       "%8s: 0x%-16lx\n",	\
-	       #n1, s->n1,		\
-	       #n2, s->n2,		\
-	       #n3, s->n3,		\
-	       #n4, s->n4)
+	       #n1, P(s->n1),		\
+	       #n2, P(s->n2),		\
+	       #n3, P(s->n3),		\
+	       #n4, P(s->n4))
 
 #define pr_regs3(s, n1, n2, n3)		\
 	pr_msg("\t%8s: 0x%-16lx "	\
 	       "%8s: 0x%-16lx "		\
 	       "%8s: 0x%-16lx\n",	\
-	       #n1, s->n1,		\
-	       #n2, s->n2,		\
-	       #n3, s->n3)
+	       #n1, P(s->n1),		\
+	       #n2, P(s->n2),		\
+	       #n3, P(s->n3))
 
 	pr_msg("\t---[ GP registers set ]---\n");
 
@@ -341,7 +341,7 @@ void show_thread_info(ThreadInfoX86 *thread_info)
 		return;
 
 	pr_msg("\t---[ Thread info ]---\n");
-	pr_msg("\tclear_tid_addr:  0x%lx\n", thread_info->clear_tid_addr);
+	pr_msg("\tclear_tid_addr:  0x%lx\n", P(thread_info->clear_tid_addr));
 	pr_msg("\n");
 
 	show_core_regs(thread_info->gpregs);
diff --git a/eventfd.c b/eventfd.c
index 1a8fca3..23c5082 100644
--- a/eventfd.c
+++ b/eventfd.c
@@ -41,7 +41,7 @@ int is_eventfd_link(int lfd)
 static void pr_info_eventfd(char *action, EventfdFileEntry *efe)
 {
 	pr_info("%s: id %#08x flags %#04x counter %#016lx\n",
-		action, efe->id, efe->flags, efe->counter);
+		action, efe->id, efe->flags, P(efe->counter));
 }
 
 void show_eventfds(int fd, struct cr_options *o)
diff --git a/eventpoll.c b/eventpoll.c
index 3c77bc6..32f9ce4 100644
--- a/eventpoll.c
+++ b/eventpoll.c
@@ -48,7 +48,7 @@ int is_eventpoll_link(int lfd)
 static void pr_info_eventpoll_tfd(char *action, EventpollTfdEntry *e)
 {
 	pr_info("%seventpoll-tfd: id %#08x tfd %#08x events %#08x data %#016lx\n",
-		action, e->id, e->tfd, e->events, e->data);
+		action, e->id, e->tfd, e->events, P(e->data));
 }
 
 static void pr_info_eventpoll(char *action, EventpollFileEntry *e)
diff --git a/files-reg.c b/files-reg.c
index 66dfadd..cfd4cd3 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -289,7 +289,7 @@ static int dump_ghost_remap(char *path, const struct stat *st, int lfd, u32 id)
 
 	if (st->st_size > MAX_GHOST_FILE_SIZE) {
 		pr_err("Can't dump ghost file %s of %lu size\n",
-				path, st->st_size);
+				path, P(st->st_size));
 		return -1;
 	}
 
diff --git a/inotify.c b/inotify.c
index 3d574ba..9181c06 100644
--- a/inotify.c
+++ b/inotify.c
@@ -78,10 +78,10 @@ static int dump_inotify_entry(union fdinfo_entries *e, void *arg)
 
 	we->id = *(u32 *)arg;
 	pr_info("wd: wd 0x%08x s_dev 0x%08x i_ino 0x%16lx mask 0x%08x\n",
-			we->wd, we->s_dev, we->i_ino, we->mask);
+			we->wd, we->s_dev, P(we->i_ino), we->mask);
 	pr_info("\t[fhandle] bytes 0x%08x type 0x%08x __handle 0x%016lx:0x%016lx\n",
 			we->f_handle->bytes, we->f_handle->type,
-			we->f_handle->handle[0], we->f_handle->handle[1]);
+			P(we->f_handle->handle[0]), P(we->f_handle->handle[1]));
 	return pb_write_one(fdset_fd(glob_fdset, CR_FD_INOTIFY_WD), we, PB_INOTIFY_WD);
 }
 
@@ -136,14 +136,14 @@ static int restore_one_inotify(int inotify_fd, struct inotify_wd_info *info)
 		target = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
 		if (target < 0) {
 			pr_perror("Can't open file handle for 0x%08x:0x%016lx",
-				  iwe->s_dev, iwe->i_ino);
+				  iwe->s_dev, P(iwe->i_ino));
 			goto err;
 		}
 		snprintf(buf, sizeof(buf), "/proc/self/fd/%d", target);
 	} else
 		path = info->remap->path;
 
-	pr_debug("\t\tRestore watch for 0x%08x:0x%016lx\n", iwe->s_dev, iwe->i_ino);
+	pr_debug("\t\tRestore watch for 0x%08x:0x%016lx\n", iwe->s_dev, P(iwe->i_ino));
 
 	/*
 	 * FIXME The kernel allocates wd-s sequentially,
diff --git a/ipc_ns.c b/ipc_ns.c
index 223a436..f4463bd 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -156,7 +156,7 @@ static int dump_ipc_sem(int fd)
 static void pr_info_ipc_msg(int nr, const IpcMsg *msg)
 {
 	print_on_level(LOG_INFO, "  %-5d: type: %-20ld size: %-10d\n",
-		       nr++, msg->mtype, msg->msize);
+		       nr++, P(msg->mtype), msg->msize);
 }
 
 static void pr_info_ipc_msg_entry(const IpcMsgEntry *msg)
@@ -280,7 +280,7 @@ static int dump_ipc_msg(int fd)
 static void pr_info_ipc_shm(const IpcShmEntry *shm)
 {
 	pr_ipc_desc_entry(LOG_INFO, shm->desc);
-	print_on_level(LOG_INFO, "size: %-10lu\n", shm->size);
+	print_on_level(LOG_INFO, "size: %-10lu\n", P(shm->size));
 }
 
 static int ipc_sysctl_req(IpcVarEntry *e, int op)
diff --git a/parasite-syscall.c b/parasite-syscall.c
index ac029c9..c1f8e82 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -376,7 +376,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid,
 	ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD, ctl, tid->real);
 
 	memcpy(&core->thread_core->blk_sigset, &args->blocked, sizeof(args->blocked));
-	CORE_THREAD_INFO(core)->clear_tid_addr = (u64)args->tid_addr;
+	CORE_THREAD_INFO(core)->clear_tid_addr = (u64)P(args->tid_addr);
 	tid->virt = args->tid;
 	core_put_tls(core, args->tls);
 
@@ -403,9 +403,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)
@@ -561,7 +561,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
 		}
 
 		pr_info("vma %lx-%lx  dumped: %lu pages %lu skipped %lu total\n",
-				vma_area->vma.start, vma_area->vma.end,
+				P(vma_area->vma.start), P(vma_area->vma.end),
 				parasite_dumppages->nrpages_dumped,
 				parasite_dumppages->nrpages_skipped,
 				parasite_dumppages->nrpages_total);
diff --git a/pie/parasite.c b/pie/parasite.c
index 3e444ea..4d98701 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 4320f27..c8ceb6c 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -154,10 +154,10 @@ static void restore_rlims(struct task_restore_core_args *ta)
 static int restore_thread_common(struct rt_sigframe *sigframe,
 		struct thread_restore_args *args)
 {
-	sys_set_tid_address((int *)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);
 
 	/*
@@ -255,14 +255,14 @@ static u64 restore_mapping(const VmaEntry *vma_entry)
 		prot |= PROT_WRITE;
 
 	pr_debug("\tmmap(%lx -> %lx, %x %x %d\n",
-			vma_entry->start, vma_entry->end,
+			P(vma_entry->start), P(vma_entry->end),
 			prot, flags, (int)vma_entry->fd);
 	/*
 	 * Should map memory here. Note we map them as
 	 * 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,
@@ -399,7 +399,7 @@ long __export_restore_task(struct task_restore_core_args *args)
 		if (!vma_entry_is(vma_entry, VMA_AREA_REGULAR))
 			continue;
 
-		pr_debug("Examine %lx-%lx\n", vma_entry->start, vma_entry->end);
+		pr_debug("Examine %lx-%lx\n", P(vma_entry->start), P(vma_entry->end));
 
 		if (addr < args->premmapped_addr) {
 			if (vma_entry->end >= args->premmapped_addr)
@@ -481,7 +481,7 @@ long __export_restore_task(struct task_restore_core_args *args)
 		va = restore_mapping(vma_entry);
 
 		if (va != vma_entry->start) {
-			pr_err("Can't restore %lx mapping with %lx\n", vma_entry->start, va);
+			pr_err("Can't restore %lx mapping with %lx\n", P(vma_entry->start), P(va));
 			goto core_restore_end;
 		}
 	}
@@ -507,7 +507,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);
 	}
@@ -528,8 +528,8 @@ long __export_restore_task(struct task_restore_core_args *args)
 				if (ret) {
 					pr_err("madvise(%lx, %ld, %ld) "
 					       "failed with %ld\n",
-						vma_entry->start,
-						vma_entry_len(vma_entry),
+						P(vma_entry->start),
+						P(vma_entry_len(vma_entry)),
 						i, ret);
 					goto core_restore_end;
 				}
diff --git a/pipes.c b/pipes.c
index 16a2454..8b801b8 100644
--- a/pipes.c
+++ b/pipes.c
@@ -186,7 +186,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
 
 		if (ret == 0 || ret > iov.iov_len /* sanity */) {
 			pr_err("%#x: Wanted to restore %lu bytes, but got %d\n", id,
-					iov.iov_len, ret);
+					P(iov.iov_len), ret);
 			ret = -1;
 			goto err;
 		}
diff --git a/proc_parse.c b/proc_parse.c
index 81bf11c..8a81179 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -161,7 +161,7 @@ static int is_anon_shmem_map(dev_t dev)
 		munmap(map, PAGE_SIZE);
 
 		shmem_dev = buf.st_dev;
-		pr_info("Found anon-shmem piggie at %lx\n", shmem_dev);
+		pr_info("Found anon-shmem piggie at %lx\n", P(shmem_dev));
 	}
 
 	return shmem_dev == dev;
@@ -197,7 +197,7 @@ int parse_smaps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
 			if (!strncmp(buf, "Nonlinear", 9)) {
 				BUG_ON(!vma_area);
 				pr_err("Nonlinear mapping found %016lx-%016lx\n",
-				       vma_area->vma.start, vma_area->vma.end);
+				       P(vma_area->vma.start), P(vma_area->vma.end));
 				/*
 				 * VMA is already on list and will be
 				 * freed later as list get destroyed.
@@ -248,7 +248,7 @@ int parse_smaps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
 					if (!S_ISSOCK(buf.st_mode))
 						goto err_bogus_mapfile;
 
-					pr_info("Found socket %lu mapping @%lx\n", buf.st_ino, start);
+					pr_info("Found socket %lu mapping @%lx\n", P(buf.st_ino), start);
 					vma_area->vma.status |= VMA_AREA_SOCKET | VMA_AREA_REGULAR;
 					vma_area->vm_socket_id = buf.st_ino;
 				} else if (errno != ENOENT)
@@ -358,7 +358,7 @@ err:
 
 err_bogus_mapping:
 	pr_err("Bogus mapping 0x%lx-0x%lx (flags: %#x vm_file_fd: %d)\n",
-	       vma_area->vma.start, vma_area->vma.end,
+	       P(vma_area->vma.start), P(vma_area->vma.end),
 	       vma_area->vma.flags, vma_area->vm_file_fd);
 	goto err;
 
diff --git a/shmem.c b/shmem.c
index cb52634..f716c95 100644
--- a/shmem.c
+++ b/shmem.c
@@ -59,7 +59,7 @@ static int collect_shmem(int pid, VmaEntry *vi)
 	}
 
 	pr_info("Add new shmem 0x%lx (0x0160x%lx-0x0160x%lx)",
-				vi->shmid, vi->start, vi->end);
+				P(vi->shmid), P(vi->start), P(vi->end));
 
 	si = &rst_shmems->entries[nr_shmems];
 	rst_shmems->nr_shmems++;
@@ -94,7 +94,7 @@ int prepare_shmem_pid(int pid)
 		if (ret <= 0)
 			break;
 
-		pr_info("vma 0x%lx 0x%lx\n", vi->start, vi->end);
+		pr_info("vma 0x%lx 0x%lx\n", P(vi->start), P(vi->end));
 
 		if (!vma_entry_is(vi, VMA_ANON_SHARED) ||
 		    vma_entry_is(vi, VMA_AREA_SYSVIPC)) {
@@ -167,9 +167,9 @@ int get_shmem_fd(int pid, VmaEntry *vi)
 	int f;
 
 	si = find_shmem(rst_shmems, vi->shmid);
-	pr_info("Search for 0x%016lx shmem 0x%lx %p/%d\n", vi->start, vi->shmid, si, si ? si->pid : -1);
+	pr_info("Search for 0x%016lx shmem 0x%lx %p/%d\n", P(vi->start), P(vi->shmid), si, si ? si->pid : -1);
 	if (!si) {
-		pr_err("Can't find my shmem 0x%016lx\n", vi->start);
+		pr_err("Can't find my shmem 0x%016lx\n", P(vi->start));
 		return -1;
 	}
 
@@ -191,7 +191,7 @@ int get_shmem_fd(int pid, VmaEntry *vi)
 			MAP_SHARED | MAP_ANONYMOUS, -1, 0);
 	if (addr == MAP_FAILED) {
 		pr_err("Can't mmap shmid=0x%lx size=%ld\n",
-				vi->shmid, si->size);
+				P(vi->shmid), si->size);
 		return -1;
 	}
 
diff --git a/sk-inet.c b/sk-inet.c
index b411c28..b80e0ba 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -426,8 +426,8 @@ static int inet_validate_address(InetSkEntry *ie)
 		return 0;
 
 	pr_err("Addr len mismatch f %d ss %lu ds %lu\n", ie->family,
-			pb_repeated_size(ie, src_addr),
-			pb_repeated_size(ie, dst_addr));
+			P(pb_repeated_size(ie, src_addr)),
+			P(pb_repeated_size(ie, dst_addr)));
 
 	return -1;
 }
diff --git a/sk-packet.c b/sk-packet.c
index 9b667c4..6634cfd 100644
--- a/sk-packet.c
+++ b/sk-packet.c
@@ -228,7 +228,7 @@ int dump_socket_map(struct vma_area *vma)
 		return -1;
 	}
 
-	pr_info("Dumping socket map %x -> %lx\n", sd->file_id, vma->vma.start);
+	pr_info("Dumping socket map %x -> %lx\n", sd->file_id, P(vma->vma.start));
 	vma->vma.shmid = sd->file_id;
 	return 0;
 }
@@ -344,7 +344,7 @@ static int restore_mreqs(int sk, PacketSockEntry *pse)
 		pr_info("Restoring mreq type %d\n", ml->type);
 
 		if (ml->addr.len > sizeof(mreq.mr_address)) {
-			pr_err("To big mcaddr %lu\n", ml->addr.len);
+			pr_err("To big mcaddr %lu\n", P(ml->addr.len));
 			return -1;
 		}
 
diff --git a/util.c b/util.c
index 82220ff..a00847b 100644
--- a/util.c
+++ b/util.c
@@ -87,6 +87,7 @@ static void vma_opt_str(const struct vma_area *v, char *opt)
 void pr_vma(unsigned int loglevel, const struct vma_area *vma_area)
 {
 	char opt[VMA_OPT_LEN];
+	memset(opt, 0, VMA_OPT_LEN);
 
 	if (!vma_area)
 		return;
@@ -94,12 +95,12 @@ void pr_vma(unsigned int loglevel, const struct vma_area *vma_area)
 	vma_opt_str(vma_area, opt);
 	print_on_level(loglevel, "%#lx-%#lx (%liK) prot %#x flags %#x off %#lx "
 			"%s shmid: %#lx\n",
-			vma_area->vma.start, vma_area->vma.end,
-			KBYTES(vma_area_len(vma_area)),
+			P(vma_area->vma.start), P(vma_area->vma.end),
+			P(KBYTES(vma_area_len(vma_area))),
 			vma_area->vma.prot,
 			vma_area->vma.flags,
-			vma_area->vma.pgoff,
-			opt, vma_area->vma.shmid);
+			P(vma_area->vma.pgoff),
+			opt, P(vma_area->vma.shmid));
 }
 
 int close_safe(int *fd)
@@ -388,7 +389,7 @@ int copy_file(int fd_in, int fd_out, size_t bytes)
 		if (ret == 0) {
 			if (bytes && (written != bytes)) {
 				pr_err("Ghost file size mismatch %lu/%lu\n",
-						written, bytes);
+						P(written), P(bytes));
 				return -1;
 			}
 			break;
@@ -435,7 +436,7 @@ void *shmalloc(size_t bytes)
 	void *ret;
 
 	if (bytes > SH_BUF_CHUNK) {
-		pr_err("Too big shared buffer requested %lu\n", bytes);
+		pr_err("Too big shared buffer requested %lu\n", P(bytes));
 		return NULL;
 	}
 
-- 
1.7.10.4



More information about the CRIU mailing list