Commit 0bca2867 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

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: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 084a630d
...@@ -530,7 +530,7 @@ static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem) ...@@ -530,7 +530,7 @@ static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem)
int ret, size; int ret, size;
u16 *values; u16 *values;
size = sizeof(u16) * sem->nsems; size = round_up(sizeof(u16) * sem->nsems, sizeof(u64));
values = xmalloc(size); values = xmalloc(size);
if (values == NULL) { if (values == NULL) {
pr_err("Failed to allocate memory for semaphores set values\n"); 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) ...@@ -538,7 +538,7 @@ static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem)
goto out; goto out;
} }
ret = read_img_buf(fd, values, round_up(size, sizeof(u64))); ret = read_img_buf(fd, values, size);
if (ret < 0) { if (ret < 0) {
pr_err("Failed to allocate memory for semaphores set values\n"); pr_err("Failed to allocate memory for semaphores set values\n");
ret = -ENOMEM; ret = -ENOMEM;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment