2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

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 <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2013-05-21 19:06:03 +04:00 committed by Pavel Emelyanov
parent 084a630dfd
commit 0bca286722

View File

@ -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;