mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +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:
committed by
Pavel Emelyanov
parent
084a630dfd
commit
0bca286722
4
ipc_ns.c
4
ipc_ns.c
@@ -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)
|
|||||||
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;
|
||||||
|
Reference in New Issue
Block a user