From 0bca28672224e1b751e7c7b093d18e90e8a40fd6 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Tue, 21 May 2013 19:06:03 +0400 Subject: [PATCH] ipc_ns: allocate enough memrory for the buffer ==22653== Syscall param read(buf) points to unaddressable byte(s) ==22653== at 0x50480B0: __read_nocancel (in /usr/lib64/libpthread-2.17.so) ==22653== by 0x40CF7C: parasite_dump_pages_seized (mem.c:244) ==22653== by 0x41681D: cr_dump_tasks (cr-dump.c:1533) ==22653== by 0x40448C: main (crtools.c:309) Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- ipc_ns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc_ns.c b/ipc_ns.c index 0fd531189..3c1badd1d 100644 --- a/ipc_ns.c +++ b/ipc_ns.c @@ -530,7 +530,7 @@ static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem) int ret, size; u16 *values; - size = sizeof(u16) * sem->nsems; + size = round_up(sizeof(u16) * sem->nsems, sizeof(u64)); values = xmalloc(size); if (values == NULL) { pr_err("Failed to allocate memory for semaphores set values\n"); @@ -538,7 +538,7 @@ static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem) goto out; } - ret = read_img_buf(fd, values, round_up(size, sizeof(u64))); + ret = read_img_buf(fd, values, size); if (ret < 0) { pr_err("Failed to allocate memory for semaphores set values\n"); ret = -ENOMEM;